Commit Graph

1657 Commits (2939abf5f876a7454e0afbc06b32c888989b6546)

Author SHA1 Message Date
nabijaczleweli 360b347ad7 Export backgrounds in vector files
VectorFileWriter::Background() is an empty impl, except that it writes
  * a rectangle the size of the output for EPS and PDF, and
  * a <style> element setting background-color for SVG

Ref: #525
2020-09-05 20:58:07 -04:00
nabijaczleweli 028b613f10 Add ExportBackgroundColor config to GUI and CLI 2020-09-05 20:58:07 -04:00
phkahler d3da2c8b22 Performance: Don't call std::inplace_merge for IdList::AddAndAssignID() via Add() because it is redundant. 2020-08-29 15:34:48 -04:00
phkahler 6894b0c9c3 NFC: remove a critical section, runs faster. 2020-08-19 17:55:42 -04:00
phkahler d974615d0e NFC replace 2 nested loops with 1 loop and a lookup for speed improvement. 2020-08-19 17:55:42 -04:00
phkahler bc4924ae47 Don't duplicate points when connecting contours with zero length bridge. Fixes #303 2020-08-14 16:39:09 -04:00
phkahler 04b332dfd0 Ratpoly - Less noise in terminal. Comment out expected dbg print and try harder to converge. 2020-08-13 16:56:18 -04:00
Paul 4cceaa5310 NURBS boolean improvement.
The 3-plane intersection code fails to converge when a curve joins two tangent NURBS patches. This adds a new function for intersecting exact curves with a surface to avoid those failures. Fixes simplified test model for issue #315.
2020-08-13 16:56:18 -04:00
phkahler f9529916c4 Fix issue161 and 174. Use the same logic for selction and dragging, but ignore entites that are inherently undraggable.
This allows the selection to reach through entities to their corresponding ones on the underlying sketch which can be dragged if they are not fully constrained. This is decided in a new function Entity::CanBeDragged().
2020-08-09 19:55:33 -04:00
phkahler 575ddb5aaa Add a pass in triangulation to create convex triangle fans. These triangles will have smaller bounding boxes and look better. 2020-08-07 15:47:01 -04:00
phkahler b3eb589240 Fix issue659 - Problems constraining to ends of Helix.
Create a new copy type for faces that includes the translation aspect of helical extrusions. Also swap the end remappings when the shell is inside out - this was also affecting some Revolve extrusions.
2020-08-07 15:16:47 -04:00
phkahler 6ae417adb5 Update mimalloc to v1.6.4 2020-08-07 14:46:09 -04:00
whitequark a2962207dd Improve text screen for a selected entity.
* Add a link to its request, unless it's the first entity in that
    request (which would just select the same entity again).
  * Add a link to its group.
  * Add a link to its workplane.
  * Add a link to its style; and hide the style row for entities that
    aren't stylable.
  * Show constraints and measurements (reference constraints) in
    separate lists.
  * For curve entities, show constraints that apply to the points
    related to the curve, not just to the curve itself.
2020-08-07 18:06:42 +00:00
whitequark afa9e2890e Improve text screen for a selected constraint.
* Show the type of a constraint.
  * Show the workplane a constraint is in, for constraints which can
    be both projected to workplane or be free in 3d space.
  * Clearly distinguish reference from non-reference constraints.
  * Add a checkbox for toggling the reference option.
  * When showing requests a constraint applies to, highlight on hover
    the specific entity being constrained, not just the first one.
2020-08-07 18:06:42 +00:00
phkahler fef6a39a17 Don't init srand(0) because rand isn't used any more. 2020-08-03 15:41:47 -04:00
phkahler 3c2f82b7f1 Remove the Random() function and use a fixed table of arbitrary vectors in raycast.cpp
This also fixes issue #666.
2020-08-03 10:30:54 -04:00
phkahler fd2dfe87f6 Fix #656 by making SSurface::SplitInHalf thread safe.
SSurface::SplitInHalf was modifying the surface and then restoring it at the end. Make temporary copy instead.
2020-08-01 11:52:20 -04:00
whitequark d8b76ef7f1 Drop backtrace generation.
This has been completely broken since 2018 (commit a93283df), and no
one noticed, so it probably wasn't useful. Instead of fixing it, just
drop the feature and a bunch of odd nonportable code.
2020-07-28 14:56:55 +00:00
whitequark bbf402bfe3 Fix "Sketch → In Workplane" not updating the UI immediately. 2020-07-28 14:10:19 +00:00
whitequark 56e2592e2a Make "Toggle Reference" remember undo state.
Turning a reference dimension into a constraint one can make
the sketch unsolvable, which suggests Edit → Undo, which would undo
either too much or nothing at all.
2020-07-28 13:12:14 +00:00
phkahler e0fa99bad4 remove another redundant pass checking earness 2020-07-22 10:27:01 -04:00
phkahler 2640034124 NFC: Remove a redundant pass over all verticies in ear triangulation. 2020-07-22 10:27:01 -04:00
whitequark b0fc1912ea Create mimalloc heaps only when necessary.
The mimalloc temporary heap is a thread-local object that uses RAII
to manage heap lifetimes even in threads that are created implicitly,
e.g. by OpenMP. However, not all threads are necessarily created by
the application; graphics drivers may create their own threads, and
this can lead to deadlocks when combined with library unloading.

Fixes #657.
2020-07-22 11:05:01 +00:00
phkahler 188b2e26ce Implement #524 Allow flat colors. Adds an edit control for Ambient lighting. 2020-07-18 02:15:41 +00:00
phkahler c75b2e473e Fix #647 Helix mesh defects.
Use the grid spacing algorithm for helical curve PWL creation.
This makes the grid and trim curves have similar spacing.
2020-07-12 19:09:26 -04:00
xzcvczx f0623fa5ba
CMake: don't install mimalloc. 2020-07-12 20:57:02 +00:00
наб c4ca4be91e Replace {Alloc,FreeAll}Temporary() with mimalloc
The heaps are wrapped in a RAIIish thread_local handler,
since being affined affined to a single thread for allocations is
required by the API

Ref: #642
2020-07-12 02:37:07 +00:00
наб cbac182edf Add and build mimalloc at 07c6e60a5a3bd7de09e4a170cd97bafba59cfafd 2020-07-12 02:37:07 +00:00
phkahler 9802b5d1ee Better helical triangulation - issue 489.
Resolve issue #489 helix has stairsteps.
Force helix axis line to 8 segments.
Grid triangulation to use a minimum of 4 segments for degree>1.
Adds twist dependence for grid triangulation with degree=1.
Added a max_dt parameter for PWL creation and use that for helical edges.
2020-07-11 14:29:18 -04:00
наб 873085edbd
README: fix extlib/q3d{o,} typo 2020-07-09 09:19:21 +00:00
whitequark 211ae8c446 Show area of closed contour with SI units.
Similar to the way that Analyze → Measure Area... works.

Fixes #639.
2020-06-23 02:39:57 +00:00
whitequark 35c6af4929 Show center of mass using the same format as for constraints. 2020-06-23 01:16:58 +00:00
whitequark 586b0477d2 Delete all entities on a workplane request that is being deleted.
Fixes #628.
2020-06-23 01:05:51 +00:00
whitequark d238f985fb GTK: filter events more precisely.
Turns out that GDK_MOD2_MASK, at least on some systems, corresponds
to NumLock. Use the function provided by GDK to handle this.

Fixes #634.
2020-06-21 01:59:30 +00:00
whitequark a80a0337a5 Disable OpenMP.
This is unfortunate, but OpenMP is not available on some toolchains
(most MinGW builds) and, more importantly, breaks the distribution
model we use on Windows, which is a single self-contained executable.

Leave the OpenMP disabled by default everywhere so that we don't have
any second-class platforms where SolveSpace is slower than on first-
class ones.

Fixes #631.
2020-06-21 01:15:28 +00:00
whitequark 0da4a6b78a Use C++11 [[noreturn]] attribute instead of GNU-specific one. 2020-06-19 01:04:01 +00:00
phkahler 3d51b3949b Change default chord tolerance (to 0.1%) and maximum segments (to 20).
See the discussion in #627 for details.
2020-06-14 05:20:23 +00:00
phkahler c876104714 Make sure circles have at least 16 segments.
Before this commit, with the highest chord tolerance settings, circles
would render as octagons, which confused a lot of people. See #295.
2020-06-14 05:13:50 +00:00
phkahler e83e48392e Change criteria for short edge removal 2020-06-11 21:23:01 -04:00
phkahler 94a3cfdeb7 Fix SSurface::EdgeNormalsWithinSurface() to handle non-orthogonal u,v derivatives correctly. 2020-06-06 02:31:01 +00:00
whitequark 225f82a292 Get rid of the FPS counter.
The counter was added solely as a debug feature in commit e7c8c1c8,
which introduced the new Canvas system. It doesn't work all that well
and brings little value, so let's get rid of the visual noise.
2020-05-31 17:04:03 +00:00
phkahler 89e6559e2d Bring some parallelism to boolean code 2020-05-22 22:32:02 -04:00
whitequark c89a2e4f62 Use a thread-safe temporary arena on every platform.
This commit continues the work started in commits 521473ee and
e84fd464 that parallelizes certain geometric operations. This commit
cleans up the temporary arena implementations and makes them
thread-safe.

Also, in commit 521473ee, a call to FreeAllTemporary() was added
during initialization to create the heap on Windows. This is now
not necessary as the heap is created transparently on the first call
to AllocTemporary().
2020-05-22 18:06:22 +00:00
whitequark 060a3280f7 Use HTML comments in issue template.
Many people don't replace all text that should be filled in, which
makes issues harder to read. Make the text at least invisible.
2020-05-21 11:39:37 +00:00
whitequark 72d9978cac Eliminate a trailing dot before the SI prefix if there are no decimals.
Fixes #617.
2020-05-21 11:22:37 +00:00
whitequark 51f62362a1 Simplify MmToString. NFC. 2020-05-21 11:22:37 +00:00
ruevs 70ec7cc257 Improve triangle mesh (splitting of quads based on angle).
When checking the dot product of the tangents `tu` and `tv` to decide
in which direction to split a quad compare it to to LENGTH_EPS instead
of zero to avoid alternating triangle "orientations" when the tangents
are orthogonal (revolve, lathe etc.).
This improves the quality of the resulting triangle mesh.
2020-05-12 18:39:25 -04:00
phkahler 23dfd97285 Fix use-after-free in Lathe, Revolve, and Helix. Issue #611. 2020-05-12 16:12:09 -04:00
whitequark 0be42a8b29 Rename our isnan() function to IsReasonable().
Commit ea6db67 added an unusual isnan macro:

  #define isnan(x) (((x) != (x)) || (x > 1e11) || (x < -1e11))

Commit 8bc322e adds a preprocessor guard that looks like it would
cause the isnan function from math.h to be preferred, but doesn't
actually do that on many platforms, e.g. glibc:

  #ifndef isnan
  #   define isnan(x) (((x) != (x)) || (x > 1e11) || (x < -1e11))
  #endif

This commit renames our isnan() to make it clear that it differs
from the standard library operation, and makes it a function.

Fixes #603.
2020-05-12 14:08:21 +00:00
Maximilian Federle 771086fa50
Use C++ instead of C versions of standard library headers.
We use std::fabs, but <math.h> doesn't provide it; it worked by accident.
Include <cmath> that provides std::fabs, and switch all other headers to
their C++ variants, too.
2020-05-12 13:49:19 +00:00