Commit Graph

1988 Commits (d5e8a8267cefe84f15541249ab886aead94c0935)

Author SHA1 Message Date
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
phkahler e84fd4649b
Use omp critical to simplify parallel triangulation. NFC. 2020-05-11 18:57:02 +00:00
phkahler c355a4730a Split quads based on angle. 2020-05-11 13:54:04 -04:00
ruevs 1930602e0a UI: split "union assemble" and "difference intersection" on two lines. 2020-05-10 17:11:19 -04:00
ruevs 9b07aaf262 UI: Fix the logic for switching between union/assemble and difference/intersection
The logic that is flipping the extrusions was working by chance.
2020-05-10 17:11:19 -04:00
ruevs 6245c63f2e Intersection boolen in triangle mesh mode is properly implemented
In addition the union operation in tiangle mesh mode is changed
to keep coplanar faces the same way as the NURBS union does.

Finalizes: https://github.com/solvespace/solvespace/issues/35
2020-05-10 17:11:19 -04:00
ruevs 3888909d02 NURBS: Add intersection boolean operation.
The NURBS operation is properly implemented.

ToDo: The mesh operation in SMesh::MakeFromIntersectionOf
is still done as C=A-(A-B).

Implements: https://github.com/solvespace/solvespace/issues/35
2020-05-10 17:11:19 -04:00
whitequark c95a07a1de Win32: when building with MSVC, require VS2015.
VS2013 does not have constexpr support and in general is quite buggy.
There's no reason to use it anymore as even XP toolsets are available
for VS2015 and VS2017.
2020-05-10 12:20:21 +00:00
ruevs cd30e04134 Expand "edit newly added dimensions" to edit "Length Ratio" and "Length Difference" 2020-05-10 11:50:51 +00:00
ruevs 01af666696
Fix typo. NFC. 2020-05-10 11:35:21 +00:00
ruevs e29f71fc87 Update changelog
f7b6f6930e
162897eca7
14e095c93a
2020-05-10 11:32:31 +00:00
whitequark d857e3e9cd Various header cleanups. NFC.
* Don't use a reserved identifier in include guards.
  * Use fabs() from <cmath> instead of our own ffabs().
    This shouldn't make any difference with modern toolchains.
  * Convert a few preprocessor macros to constexprs.
2020-05-10 09:24:12 +00:00
whitequark e00d4867e1 Refactor dbp. NFC.
After this commit, dbp() is renamed to DebugPrint() and moved to
platform.cpp, next to other similar functions. The existing short
name is provided by a preprocessor macro, similar to ssassert().

This leaves just the (rather hacky) temporary heap in util*.cpp.
2020-05-10 08:54:12 +00:00
whitequark 9951da8965 macOS: ignore spurious `-psn_` command line argument.
Fixes #602.
2020-05-10 08:30:01 +00:00
whitequark 1442ee5ec3 Refactor InitPlatform.
This commit performs three related cleanups:
  * The slvs library no longer uses explicit platform initialization
    (which drags in the side effects of InitPlatform that are not
    desirable in a library). Instead, it just ensures that it has
    the temporary heap, which is what it was callingInitPlatform for.
  * InitPlatform is simplified and moved to platform.cpp, next to
    other path related functions.
  * InitPlatform is renamed to InitCli and is called from InitGui
    implementations. GUI toolkits sometimes have options they use
    internally (that's the case for for GTK and Cocoa at least),
    and we shouldn't try to parse those as a file to open.
2020-05-10 08:29:25 +00:00
whitequark 9c1804b1b5 Get rid of MemAlloc/MemFree.
After commit 521473ee there's no point in keeping these around.
Instead, use the same heap in containers as the C++ standard library.
2020-05-10 06:11:53 +00:00
whitequark 521473ee4b Win32: use CRT heap instead of our own.
Historically SolveSpace used its own heap on Windows since it gave
better control and debugging options, but a lot of development these
days happens on Linux, where that heap was a stub around malloc/free,
and also Windows debugging tools got a lot better.

In terms of immediate benefit, this commit fixes heap corruption
on Windows introduced in commits b4e1ce44 and 47e82798, caused
by allocating with HEAP_NO_SERIALIZE in parallel from OpenMP threads.
Without HEAP_NO_SERIALIZE there's no performance benefit to keeping
our own heap, either.

The vl() function is also removed because for development there are
better tools now, and the only place where it was permanently called
from became a no-op, since temporary heap always validates after
FreeAllTemporary() recreates it.
2020-05-10 05:35:42 +00:00
whitequark 74103eee81 CMake: expand sanitizer support to include TSan. 2020-05-10 02:52:39 +00:00
whitequark 47e82798da CMake: detect OpenMP and use if available.
This is a missing part of commit b4e1ce44.
2020-05-09 19:46:16 +00:00
phkahler b4e1ce44e8 Use OpenMP for triangulation 2020-05-09 13:54:52 -04:00