Commit Graph

84 Commits

Author SHA1 Message Date
phkahler
408128a138 Avoid zero tangnet vectors on degenerate NURBS edges. Fixes #652 2020-10-18 14:54:00 -04:00
phkahler
d72eba8039 Create intersection curves from existing ones.
When a plane coinsides with a seam we need to copy that trim curve. The existing curve belongs to the original shell surfaces and an intersection is otherwise not found. Fixes #540.
2020-10-10 02:02:34 -04:00
phkahler
d8f5a8da32 Fix issue #296.
We need to recognize two consecutive bridges as a non-ear.
2020-09-08 18:54:02 -04:00
phkahler
705249627a Fix #693 issues.
This set of changes covers all triangulation errors in issue 693. A point coincident with a triangle vertex is OK and needed for bridges, but sometimes the middle point has edges cutting through the triangle that make it a non-ear. We fix that and a couple of off-by-one error (that fixes one of the test cases).
2020-09-08 18:54:02 -04:00
phkahler
0413c1b926 NFC:Triangulation - don't add zero-length bridges to avoid list. 2020-09-08 18:54:02 -04:00
phkahler
b208cd8cae NFC, Performance: Use OpenMP for boolean function MakeItersectionCurvesAgainst.
This is the last long-running single-threaded part of the boolean code. On one test model this took Regenerate form 27 seconds down to 18s. The critical sections needed a name (into) because that object must not be modified while in use in different places.
2020-09-06 12:43:24 -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
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
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
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
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
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
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
phkahler
89e6559e2d Bring some parallelism to boolean code 2020-05-22 22:32:02 -04: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
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
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
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
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
phkahler
7366a6c53d
Bernstein polynomials with no branching. (#591) 2020-05-02 14:56:50 -04: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
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
ruevs
16c5fa6889 Fix eight trivial "implicit conversion 'double' to 'int'" warnings. NFC. 2019-12-17 19:35:44 +00:00
ruevs
ec3056773e Simplify UNION and DIFFERENCE boolean operations.
Union and difference are optimized by replacing the expression
  (!inShell && !inFace)
which is equivqlent to
  (!inShell && !inSame && !inOpp)
with
  outSide
which is equivalent, since SShell::Class::OUTSIDE is the only remaining possibility.
2019-11-23 13:22:15 +00:00
phkahler
162897eca7 Reimplement DivPivoting as DivProjected.
The old implementation was an approximation, whereas the new one is exact.
2019-09-20 01:09:25 +00:00
Ryan Pavlik
c0904e2ba8 Use IsEmpty() or .empty() to check if a container is empty. NFC.
Most found by clang-tidy.
2019-09-10 04:22:21 +00:00
Ryan Pavlik
231dff6cd9 Add and use List::Last(). NFC. 2019-09-10 04:20:38 +00:00
whitequark
c5f3cd151a Use the same @todo hot comment style everywhere. 2019-09-10 04:07:42 +00:00
phkahler
22e4011cb6 use std::vector in helix operations instead of fixed length array. Remove limit on number of sections. Delete definition of Revolved struct. 2019-08-25 14:30:37 +00:00
phkahler
e22c522c81 use std::vector in lathe operations instead of fixed length array 2019-08-25 14:30:37 +00:00
Ryan Pavlik
533ca618eb Fix a manual manipulation of List::n. NFC.
This broke encapsulation and thus caused problems for any deeper changes
to List.
2019-08-20 15:57:11 +00:00
Ryan Pavlik
0bfbbe2bf3 Improve implementation hiding in IdList/List. NFC.
Allows distancing users from the internal "elem" member.

Add Get() and operator[].
Replace direct references to elem.
Make elem and elemsAllocated private in IdList/List.
2019-08-20 15:57:11 +00:00
Ryan Pavlik
482f0e8de9 Replace qsort with std::sort and lambda. NFC.
Removes static variable usage, permits hiding of the underlying pointer
(std::sort uses iterators intead), type safety, etc.
2019-08-20 15:57:11 +00:00
Ryan Pavlik
5ada4dbd9c Add and use IdList::IsEmpty. NFC.
Removes consuming code from the implementation details, easing swap of
the underlying container, etc.
2019-08-20 15:57:11 +00:00
phkahler
986da7d224 Implement helical extrusion groups. 2019-07-31 04:16:56 +00:00
Ryan Pavlik
5efb09e6d4 Use the new equality/inequality operators of handles to reduce references to .v. NFC. 2019-07-10 15:40:21 +00:00