Commit Graph

1568 Commits (34328c975699e4926923a79672951e1835956178)

Author SHA1 Message Date
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
phkahler 7baf58588b No message if cached points to don't converge. Quiet the terminal. 2020-05-08 22:18:30 -04:00
phkahler a7e0a174e3 Don't create redundant edges in UvGridTriangulate into. 2020-05-08 13:24:36 -04:00
ruevs 05aa649508 Update changelog 2020-05-08 11:27:08 +00:00
phkahler a52d88bc3d Less work in AssembleContour 2020-05-06 18:38:58 -04:00
phkahler 88a0e55f35 Eliminate infinite loop AssemblePolygon 2020-05-06 18:38:58 -04:00
phkahler 7366a6c53d
Bernstein polynomials with no branching. (#591) 2020-05-02 14:56:50 -04:00
Maximilian Federle 76b3efbd08 Travis: allow Snap arm64 to fail
arm64 builds on Travis are not yet fully mature and this
causes a high failure rate that is not caused by our code.

Continue building and deploying arm64 to the edge channel,
but don't consider the result for the success of the whole
build job.

Alleviates #587
2020-04-27 20:00:07 +00:00
whitequark 35448298bc README: update Linux-to-Windows cross-compilation instructions. 2020-04-27 17:23:55 +00:00
phkahler f36ac500a1
Add rotated face from point entity type. Fixes issue 585, problems constraining to Revolve and Helix ends. (#586) 2020-04-24 17:37:55 -04:00
phkahler 700b5d6719
Allow Revolve and Helix end surface selection and constraints. (#584) 2020-04-22 19:55:18 -04:00
phkahler 45eb246865
Eliminate some entity copies in lathe groups. Eliminates a crash due to copy numbers going over 1000. May break some older files with constaints on lathed entities. (#582) 2020-04-21 00:44:27 -04:00
phkahler b55dac7620
Don't create extra copies of entities in Revolve and Helix groups.
Might break some older files with those groups that depend on these
extra entities.

Fixes #549.
2020-04-21 01:24:33 +00:00
Ryan Pavlik e51fdf6fba Use handles instead of pointers in GenerateAll(). NFC. 2020-04-20 18:37:03 +00:00
Maximilian Federle f5415b3fe6 snap: Upgrade from gnome-3-28 extension to gnome-3-34
Using gnome-3-34 gives us a newer stack in general
and also provides us with a sdk build-snap, so we don't need
to specify as many build-packages and stage-packages.

This makes the snap slimmer and delegates the responsibility
for security updates to the gnome platform snap for even more
packages.
2020-04-17 09:17:53 +00:00
Maximilian Federle 13b461d750 snap: Use symlink instead of bind-mount for layout
As per https://snapcraft.io/docs/snap-layouts,
bind-mounts significantly increase the startup time of the snap.
Use symlink instead for better performance.
2020-04-16 18:56:13 +00:00
Tim 72635df56e
Add menu options for line styles / view / configuration.
This is to make them a bit easier to find, since the natural place
to look for config options is somewhere like File->Preferences or
Edit->Settings.
2020-04-01 21:25:18 +00:00
Tim 647171017a
Fix more segfaults in mouse.cpp lambdas (#574)
This changes all the lambdas to have explicit captures, since the use of
implicit captures has led to some memory errors, especially segfaults in
the right-click menu.

I'm not 100% sure that the code is correct anyway - it really needs auditing
to ensure all referenced values are still valid when the menu item is clicked
(e.g. can you change stuff with keyboard shortcuts while the context menu is
visible?), but it should at least be *more* correct!
2020-03-29 01:46:34 +00:00
Tim 485fd012b4
Fix segfault in Remove Spline Point context menu
This was incorrectly capturing `r` by reference and using it after it left
its scope. Changed to  capture by value, and also explicitly capture `this`
in case we were accidentally capturing any other scope variables by reference.

Fixes #571
2020-03-28 15:28:12 +00:00
phkahler f7b6f6930e
Nurbs (#473)
* Limit u,v range between 0 and 1 in Newton. Fixes issue #471
* Change the math for projecting a point onto a plane to work better with non-orthogonal U,V derivatives in several places. Fixes #472.
2020-03-27 15:40:58 -04:00
phkahler 83b0402c84
Added developer instructions for creating new entity transformations in the solver. (#491) 2020-03-27 15:08:35 -04:00