1. 27 Mar, 2021 4 commits
  2. 16 Mar, 2021 1 commit
    • David Eberly's avatar
      Removal of final occurrences of std::fe{set,get}round. · b3ad4f40
      David Eberly authored
      The Delaunay2 code was failing on a platform using a virtual machine and Microsoft Visual Studio 2015. The problem is that the compiler is optimizing away some floating-point expressions that should not be due to rounding mode. I mentioned this problem in Section 3.4 of https://www.geometrictools.com/Books/RobustAndErrorFreeGeometricComputing/RAEFGC_BookCorrections.pdf. I removed the final uses of std::fesetround and std::fegetround, replacing them with SWInterval interval arithmetic support that works with the default FPU rounding mode (round to nearest ties to even). These modifications affect only the new ConstrainedDelaunay2 and Delaunay2 implementations. The older implementations do not use <cfenv> for floating-point environment changes, and they are currently tagged as deprecated but will exist until the full GTL distribution is available.
      b3ad4f40
  3. 15 Mar, 2021 1 commit
    • David Eberly's avatar
      Update ConstrainedDelaunay2.h · 4b1f67ba
      David Eberly authored
      The deprecated code in ConstrainedDelaunay2 (the first implementation in the header file) had a bug in Retriangulate that was introduced based on my blindly following a suggestion by the Microsoft Visual Studio code analysis tool. The description here is long but intended to let others know to be careful about the code analysis suggestions.
      
      The Retriangulate function originally had a line of code to access the top of
      the stack,
        auto i = stack[top--];
      The Microsoft Visual Studio code analysis tool complained "'auto' doesn't deduce references. A possibly unintended copy is being made} and suggested modifying to a reference "auto&" (or "auto const&}. Without thinking about the message, I changed the code to
        auto const& i = stack[top--];
      which is an error, because now I have a reference to the stack[top+1] element. Later in the function,
        stack[++top] = { i[0], isplit };
        stack[++top] = { isplit, i[1] };
      In the first line of this code, the value "top" is incremented first and then the pair is copied to the stack. The problem is that "i" is the pair to which the left-hand side of the assignment refers. The write of "i[0]" to this location overwrites itself (no problem), but the write of "isplit" to this location overwrites "i[1]" (the error). The second line of code reads "i[1]", which was inadventently modified to "isplit". I have been burned several times by the faulty suggestions of the code analyzer and learned now to think about them, replacing the "auto" keyword by the actual type or ignoring them. The same problem had occurred in the new CDT code (the second implementation in the header file), but during unit testing I had found and fixed the problem. I had not thought to go back to the old code to see whether it had the same problem. My solution was to replace
        auto const& i = stack[top--];
      by
        std::array<size_t, 2> i = stack[top--];
      4b1f67ba
  4. 08 Mar, 2021 2 commits
    • David Eberly's avatar
      Update ParametricCurve.h · 1257162b
      David Eberly authored
      All but the first mAccumulatedLength elements are uninitialized, which causes GetTotalLength() to fail. The Release-build unit tests did not fail (via NaturalSplineCurve) using Microsoft Visual Studio because the compiler initializes the elements to zero. The compiler then optimizes away the first line of code in GetTotalLength() because it believes mAccumulatedLength.back() will return zero the first time GetTotalLength() is called. This hides the bug when using MSVS. Other compilers will most likely leave mAccumulatedLength uninitialized, in which case the bug shows up.
      1257162b
    • David Eberly's avatar
      Update BSNumber.h · 42d5e361
      David Eberly authored
      The BSNumber constructors that take integer inputs need to compute the debug-supporting mValue first. The previous code modifies the inputs before computing mValue, which causes the sign to be positive when the inputs are negative. The
      problem showed up only when GTE_BINARY_SCIENTIFIC_SHOW_DOUBLE was enabled for debugging and testing and does not affect the correctness of the actual BSNumber.
      42d5e361
  5. 11 Feb, 2021 1 commit
    • David Eberly's avatar
      Update PrecisionCalculator.cpp · b43f145a
      David Eberly authored
      Added counting of maximum number of words for testing for sum of two squares and for (not yet published) Delaunay2 that computes the triangulation using a 3D convex hull for points (x,y,x^2+y^2).
      b43f145a
  6. 10 Feb, 2021 2 commits
    • David Eberly's avatar
      Fixed bug for line-sphere and line-ellipsoid find-intersection in tangent case. · 8a6e12f7
      David Eberly authored
      The ray-sphere and segment-sphere queries were generating incorrect results when the linear component is tangent to the sphere. This occurred because result.parameter[1] is uninitialized in the line-sphere query for the tangent case, and the ray-sphere and segment-sphere code uses both result.parameter[] values for interval-interval intersection. The Result nested-class constructors now have all members initialized, and result.parameter[1] is set to result.parameter[0] in the tangent case. The same issues arise with ray-ellipsoid and segment-ellipsoid queries; they were fixed in the same manner.
      8a6e12f7
    • David Eberly's avatar
      Update PrecisionCalculator.cpp · 5deda24e
      David Eberly authored
      Added counting of maximum number of words for testing for coplanar points. Added a comment with a formula for determining the number of bytes used by BSNumber<UIntegerFP32<N>>. The value is 4*(N+4).
      5deda24e
  7. 03 Feb, 2021 1 commit
    • David Eberly's avatar
      Update ConvexHull3.h · dba59aef
      David Eberly authored
      In Hull3, the incoming hull has coplanar points. When inserting the next point, the hull becomes volumetric. The incoming hull triangles are inserted into the VET mesh, but the winding orders are reversed. The triangles generated after that have the correct winding order. Fixed the winding order.
      dba59aef
  8. 29 Jan, 2021 2 commits
    • David Eberly's avatar
      Update PrecisionCalculator.cpp · 35ae351a
      David Eberly authored
      Added counting of maximum number of words for testing for colinear points.
      35ae351a
    • David Eberly's avatar
      Update UIntegerFP32.h · 67e9c181
      David Eberly authored
      Added debug support for counting the maximum number of blocks of bits used in UIntegerFP32<N> during application execution. The class UIntegerAP32 already has this support.
      67e9c181
  9. 17 Jan, 2021 1 commit
    • David Eberly's avatar
      Fixed the failure in MinimumVolumeBox3.h · 451e412a
      David Eberly authored
      I figured out why MinimumVolumeBox3D was broken. It turns out that the member function CreateCompactMesh has an implicit assumption that the vertices in the VETManifoldMesh::Vertex are ordered by the integer key. This assumption was satisifed when the vertex map was a std::map, but not when the vertex map was changed to a std::unordered_map. I restored the vertex map to be an unordered map and added code to the minimum-volume box to sort the vertices before creating the compact array of vertex adjacencies.
      451e412a
  10. 15 Jan, 2021 5 commits
    • David Eberly's avatar
      Update VETManifoldMesh.h · acff1fa1
      David Eberly authored
      The sample GTE/Samples/Geometrics/MinimumVolumeBox3D was broken in that the displayed box no longer contained the convex polyhedron. I traced this back to GTE 5.4 where I replaced the std::set and std::map objects by std::unordered_set} and std::unordered_map objects. For a reason that I am unable to understand, the sample runs correctly when using std::map for VETManifoldMesh::VMap, but it does not run correctly when using std::unordered_map for VETManifoldMesh::VMap. The key type in either case is the native type int32_t. For now, I restored VMap to use std::map.
      acff1fa1
    • David Eberly's avatar
      Posting GTE 5.6. · f4f6e008
      David Eberly authored
      Modified the copyright notices to include 2021.
      f4f6e008
    • David Eberly's avatar
      Greatly improved performance for ConvexHull3 · 7a45114c
      David Eberly authored
      The ConvexHull3 performance was absolutely awful, requiring over 1 hour to compute the hull of a 120K-vertex dataset. I reimplemented this to use incremental insertion (single-threaded) and a divide-and-conquer algorithm (multithread). On an Intel i9-10900 CPU, the incremental insertion for the 120K-vertex dataset executes in approximately 4 seconds. The divide-and-conquer algorithm using 8 threads executes in approximately 1.7 seconds. Files that depend on ConvexHull3 were modified accordingly.
      7a45114c
    • David Eberly's avatar
      Create SWInterval.h · 55494e79
      David Eberly authored
      Added a new file for interval arithmetic. The implementation is software based and uses std::nextafter for determining the intervals. This avoids the floating-point hardware state changes when setting the rounding modes, and it avoids the problem with GCC that appears not to expose the ability to modify the floating-point environment.
      55494e79
    • David Eberly's avatar
      Update ETManifoldMesh.h · 943babc5
      David Eberly authored
      Replaced "int V[3]" by "std::array<int, 3> V" in the ETManifoldMesh::Triangle class. A similar change had been made already to ETManifoldMesh::Edge.
      943babc5
  11. 25 Dec, 2020 1 commit
    • David Eberly's avatar
      Update DX11Engine.cpp · 5fc64438
      David Eberly authored
      The DX11Engine constructors that have a window handle input are designed for rendering to the window. These constructors create default render states that GTE wants, and these states are not all the default DX11 render states. The DX11Engine constructors that do not have a window handle input are designed for windowless applications using compute shaders. These constructors do not create default render states for GTE, so the default states are those of DX11. To support a windowless application that renders to an offscreen render target, and to allow that code to work whether windowed or windowless, I added creation of the default GTE render states to the compute-intended DX11Engine constructors. I also removed calls to DestroyDefaultObjects in the constructors because at the time of call, all the objects do not exist.
      5fc64438
  12. 23 Dec, 2020 1 commit
    • David Eberly's avatar
      Update DataFormat.h · 6ee9bab3
      David Eberly authored
      Eliminated the annoying MSVS 2019 warning about DFType being an unscoped "enum", suggesting that "enum class" is better. These are used as indices into arrays, so "enum class" does not work. I replaced the enumeration by a list of constexpr values. The type DFType is defined to be uint32_t.
      6ee9bab3
  13. 19 Dec, 2020 3 commits
  14. 01 Dec, 2020 3 commits
    • David Eberly's avatar
      Update ConstrainedDelaunay2.h · c7dc4f62
      David Eberly authored
      Replaced the one remaining std::set object by a std::unordered_set object.
      c7dc4f62
    • David Eberly's avatar
      Update Delaunay2.h · 0b9414ed
      David Eberly authored
      While porting Delaunay2 from GTE to GTL, the more robust GTL unit tests for the ToCircumcircle function failed for nearly cocircular points (the GTE unit tests did not have a case for nearly cocircular points). Fixed the bugs in the GTE code.
      0b9414ed
    • David Eberly's avatar
      Added new interfaces to triangulation code. · 8a52d886
      David Eberly authored
      Added interfaces to allow passing a raw pointer to vertices and the number of vertices.
      8a52d886
  15. 18 Nov, 2020 9 commits
    • David Eberly's avatar
      Posting GTE 5.4. · e2e4631f
      David Eberly authored
      Incremented the GTE_MINOR_VERSION to 4.
      e2e4631f
    • David Eberly's avatar
      Update PrecisionCalculator.cpp · 8262af75
      David Eberly authored
      Added a function to compute the maximum number of words for computing the pseudosquared distance function in TriangulateCDT using BSNumber<UIntegerFP32<N>>.
      8262af75
    • David Eberly's avatar
      Modifications because of the manifold meshes and Delaunay2 updates. · 1e7a3f5c
      David Eberly authored
      Classes affected by the manifold mesh and Delaunay modifications.
      1e7a3f5c
    • David Eberly's avatar
      Update UniqueVerticesTriangles.h · 3fe11979
      David Eberly authored
      Commented out the [[deprecated("...")]] tag to avoid build failures when "Treat warnings as errors" is selected.
      3fe11979
    • David Eberly's avatar
      New classes for Delaunay2, ConstrainedDelaunay2 and TriangulateCDT. · 3b9413bf
      David Eberly authored
      Added new classes that do not require the user to specify the computing type. The old classes are now tagged as deprecated and will be removed in a later version of GTE.
      3b9413bf
    • David Eberly's avatar
      Performance improvements for meshes. · 051bb833
      David Eberly authored
      Added a new file to create hash functions in order to use std::unordered_set and std::unordered_map in GTE code, replacing std::set and std::map when a performance increase is desired.
      051bb833
    • David Eberly's avatar
      Update ConvexHull3.h and FPInterval.h · 31ef86de
      David Eberly authored
      Factored IntervalProductUp and IntervalProductDown from ConvexHull3.h to ProductLowerBound and ProductUpperBound in FPInterval.h so that the code can be shared by other computational geometry queries involving interval arithmetic.
      31ef86de
    • David Eberly's avatar
      Update UIntegerFP32.h · 71d7dca7
      David Eberly authored
      Added a new member function CopyFrom that does a direct copy from UIntegerFP32<N> to UIntegerFP32<M> as long as N is no larger than M. This allows converting floating-point inputs to UIntegerFP32<N> for N-value 2 or 4. These can then be copied on-demand into a pool of UIntegerFP32<M> for much larger M that is used to represent an expression tree that must be computed with exact arithmetic. The goal is to reduce heap memory usage when computing with arbitrary-precision arithmetic. The pool can be allocated on the heap to avoid having to greatly increase the program stack size when M is large.
      71d7dca7
    • David Eberly's avatar
      Update NaturalSplineCurve.h · e177b50b
      David Eberly authored
      Fixed a bug that was introduced when performance optimizations were added to the file. The original code had allocated vectors for mB, mC and mD. The optimized code packed these into a single chunk of memory, but the aforementioned variables which became pointers were not set to point to the proper locations in that chunk. This was only for the clamped-spline case.
      e177b50b
  16. 11 Nov, 2020 1 commit
  17. 08 Nov, 2020 1 commit
    • David Eberly's avatar
      Update ConstrainedDelaunay2.h · fa750b0a
      David Eberly authored
      When using ComputeType that is a floating-point type, rounding errors can cause sign misclassifications in the loop over linkEdges and prevent ProcessTriangleStrip and ProcessCoincidentEdge from being called. The consequence is that partition is an empty std::vector and the call to partition.back() causes a crash. I added a LogAssert call to throw an exception in this case. It is strongly recommended to use an arbitrary-precision type for ComputeType. Alternatively, use a try-catch block to triangulate using a floating-point type and, if an exception is thrown, repeat the call using an arbitrary-precision type. I also replaced the nondescriptive "Unexpected condition" in the LogAssert statements with function calls that return strings with more description.
      fa750b0a
  18. 06 Nov, 2020 1 commit
    • David Eberly's avatar
      Feature request for identifying interior triangles in PolygonTreeEx and TriangulateCDT. · ee10ea11
      David Eberly authored
      Added more members and queries to PolygonTreeEx. Previously, the insideTriangles vector stored all triangle in the polygon tree. For TriangulateCDT to be consistent with TriangulateEC, it is convenient to partition these into interiorTriangles, which are those triangles bounded by an outer polygon and its child inner polygons, and exteriorTriangles, which are those triangles bounded by an inner polygon and its child outer polygons. The point-containment query of TriangulateEC searches only the interior triangles. In fact, that class does not construct exterior triangles. I added point-containment queries for each type of vector member of PolygonTreeEx, including comments about typical usage. You can create your own queries, especially if you want to use multithreading. Also, it is sometimes convenient to know which node of the polygon tree stores the containing triangle. The node index information has also been added to PolygonTreeEx for the various triangle vector members, and a couple of the point-containment queries use these.
      ee10ea11