- Added constexpr to constructors and methods in both classes, with special handling for already-normalized inputs
- Refactored coordinate access methods to avoid pointer arithmetic (incompatible with constexpr)
- Implemented a dual-path approach: fast path for normalized inputs (constexpr-compatible) and slow path for runtime normalization
Modernized and refactored the polynomial root-finding implementation
with improved numerical stability and modern C++ practices.
Key changes:
1. Implementation refactoring (math_DirectPolynomialRoots.cxx):
- Extracted helper functions into anonymous namespace for better encapsulation
- Introduced ScaledCoefficients struct for coefficient scaling operations
- Added separate functions for cubic root cases (three real, one real, multiple)
- Replaced deprecated OCCT math functions with std:: equivalents
(std::abs, std::sqrt, std::pow, std::log, std::cos, std::sin, std::atan, std::max)
- Improved code documentation with algorithm references
2. Header modernization (math_DirectPolynomialRoots.hxx):
- Added comprehensive Doxygen documentation for all public methods
- Renamed private members to follow OCCT conventions (myDone, myRoots, etc.)
- Moved inline implementations from .lxx file directly into header
- Removed math_DirectPolynomialRoots.lxx file (merged into .hxx)
3. Test improvements:
- Added test fixture class for math_DirectPolynomialRoots with helper methods
- Extended test coverage with numerical stability tests
- Added regression tests for problematic quartic cases
- Added Geom2dGcc_Circ2d3Tan tests for BUC60622 regression case
4. Minor fixes:
- Removed unused #include <iostream> from test file
- Updated FILES.cmake to remove deleted .lxx file
- Fixed test case expected values in bug28626_2
Completed the migration of IntCurveSurface_ThePolyhedronOfHInter and
HLRBRep_ThePolyhedronOfInterCSurf to fully utilize shared template
functions in IntCurveSurface_PolyhedronUtils.pxx.
The original commit fff55ee5fc introduced the .pxx template pattern but
only migrated 4 functions, leaving significant code duplication between
the two polyhedron implementations
Changes:
- Extended IntCurveSurface_PolyhedronUtils.pxx with 15 additional
template functions: AllocateArrays, Destroy, NbTriangles, NbPoints,
Triangle, TriConnex, PlaneEquation, Contain, FillBounding, IsOnBound,
ComputeMaxDeflection, ComputeMaxBorderDeflection,
SetDeflectionOverEstimation, Parameters, Point (3 overloads)
- Refactored both .cxx files to delegate all logic to PolyUtils namespace
This aligns the Polyhedron classes with other properly migrated classes
(Polygon, Inter, QuadricCurveExactInter) where the Utils.pxx contains
all shared logic and .cxx files are minimal wrappers.
Extract derivative calculation logic from GeomEvaluator and
Geom2dEvaluator classes into dedicated utility headers:
- Geom_OffsetSurfaceUtils.pxx for 3D offset surface derivatives
- Geom_OffsetCurveUtils.pxx for 3D offset curve derivatives
- Geom2d_OffsetCurveUtils.pxx for 2D offset curve derivatives
- Geom_ExtrusionUtils.pxx for extrusion surface calculations
- Geom_RevolutionUtils.pxx for revolution surface calculations
Utility functions provide unified handling of singular and non-singular
cases with osculating surface support for higher-order derivatives.
Buffer management uses NCollection_LocalArray for stack-safe allocation
with heap fallback when sizes exceed expected limits.
Test case expectations updated to reflect improved calculation accuracy.
Cleans up the BRepClass3d_SolidExplorer class by removing the
unused Bnd_Box member and associated code,
including preprocessor directives and function definitions.
The isVertexInsidePolygon method uses the winding number algorithm,
which computes cumulative angles from the test point to polygon vertices.
For a point inside a polygon, this sum should be ±2π.
The gp_Vec2d::Angle method uses an inverted sign convention where
CCW rotation gives negative angles. For CCW polygons, the total angle
is -2π, but the original check only accepted +2π.
Changed the condition from:
std::abs(Angle2PI - aTotalAng) > Precision::Angular()
to:
std::abs(std::abs(aTotalAng) - Angle2PI) > Precision::Angular()
This correctly handles both CCW (-2π) and CW (+2π) polygon orientations.
Replace custom HLRAlgo_PolyData::Box struct with standard Bnd_Box class
to leverage its built-in update functionality and reduce code duplication.
Changes:
- Remove HLRAlgo_PolyData::Box struct definition
- Update UpdateGlobalMinMax methods to use Bnd_Box::Update()
- Simplify bounding box computation logic using Bnd_Box methods
- Use C++17 structured bindings with Bnd_Box::Get()
- Added a default constructor to CSLib_Class2d for creating empty classifiers.
- Implemented move constructor and move assignment operator to optimize resource management.
- Updated IntTools_FClass2d and BRepTopAdaptor_FClass2d to utilize the new move semantics, eliminating unnecessary dynamic memory allocations.
- Replaced deprecated pointer-based storage with NCollection_Sequence for better memory management.
- Removed the obsolete BRepTopAdaptor_SeqOfPtr class to streamline the codebase.
BRep_Tool::CurveOnSurface expects Index >= 1, but the loop started
from ii = 0, resulting in a wasted iteration that always returned
a null pointer.
Fixes#0032371
Modernized curve/surface intersection algorithms by replacing preprocessor-based
generic programming (.gxx macros) with C++ templates (.pxx headers):
IntCurveSurface package (TKGeomAlgo):
- Introduced IntCurveSurface_Inter.pxx with callback-based template functions
for intersection algorithms, replacing IntCurveSurface_Inter.gxx
- Created IntCurveSurface_InterUtils.pxx with utility template functions for
surface decomposition, UV clamping, and quadric intersection handling
- Added IntCurveSurface_PolygonUtils.pxx for polygon construction utilities
- Added IntCurveSurface_PolyhedronUtils.pxx for polyhedron construction utilities
- Added IntCurveSurface_QuadricCurveExactInterUtils.pxx for exact quadric
intersection computations
- Converted standalone implementation files from macro instantiation (_0.cxx)
to direct template usage (.cxx)
- Removed obsolete .gxx and .lxx files
HLRBRep package (TKHLR):
- Updated HLRBRep_InterCSurf to use new IntCurveSurface template utilities
- Converted HLRBRep polygon, polyhedron, and intersection classes to use
modern template instantiation pattern
- Removed legacy macro-based instantiation files (_0.cxx)
This refactoring improves code maintainability, enables better IDE support
and debugging, and aligns with modern C++ practices while preserving
the existing API and functionality.
- Moved temporary allocator reset to the end of the iteration in BOPAlgo_PaveFiller to prevent memory accumulation.
- Introduced a separate temporary allocator for per-iteration data in BOPAlgo_FillIn3DParts, enhancing memory reclamation during processing.
- Cleared face map before resetting the allocator in BOPAlgo_Tools to ensure efficient memory usage.
- Deleted copy and move constructors and assignment operators in BRepAlgoAPI_BuilderAlgo to ensure non-copyability and non-movability, preventing potential double-free issues.
- Added comprehensive unit tests to verify the non-copyable and non-movable nature of BRepAlgoAPI_BuilderAlgo and its derived classes.
- Updated CMake files to include the new test source file for build integration.
- Added `D0Local`, `D1Local`, `D2Local`, `D3Local` methods to `BSplCLib_Cache` and `BSplSLib_Cache` classes
- Added accessor methods to `Geom_BSplineCurve` and `Geom_BSplineSurface` for direct handle access to internal arrays
- Comprehensive test coverage for both curve and surface cache implementations
Refactored BSplSLib_DataContainer and BSplCLib_DataContainer_T structs:
- Use compile-time constexpr THE_MAX_DEGREE for array sizes
- Remove constructors with runtime initialization overhead
- Add standalone validateBSplineDegree() functions for degree checks
- Eliminate unnecessary zero-initialization of stack buffers
- Replace Standard_Real/Standard_Integer with native double/int types
This improves performance by avoiding runtime memset of large arrays
(~2800 doubles for surfaces, ~200 for curves) on every B-spline evaluation.
- Updated isBSplineCurveInvalid to check for uneven parameterization speed and determine the need for ProjLib usage.
- Enhanced the logic for computing parameterization speed across knot intervals.
- Simplified the handling of B-spline curves with problematic knot spacing by directly utilizing ProjLib for projection.
- Improved overall clarity and maintainability of the code by removing redundant checks and streamlining parameter handling.
- Implemented various test cases including projections of lines, circles, and B-splines on different surface types (planes, cylinders, spheres, and toroids).
- Refactored ShapeConstruct_ProjectCurveOnSurface to improve handling of periodic surfaces and edge cases.
- Updated header files to reflect new type aliases and improved structure for better readability and maintainability.
- Added a new function `extractBSplineCurve` to streamline the extraction of B-spline curves from both trimmed and untrimmed curves.
- Refactored `isBSplineCurveInvalid` to utilize the new extraction function, improving clarity and reducing code duplication.
- Updated `generateCurvePoints` to leverage the new extraction method for better handling of B-spline curves.
- Replaced std::vector with NCollection_Vector for better memory management in isBSplineCurveInvalid.
- Enhanced rebuildBSpline function to improve knot adjustment logic while preserving curve geometry.
- Introduced a new utility class, SurfaceProjectorWithCache, to enhance the projection of points onto B-spline surfaces by caching pole positions and their UV parameters.
- Updated the intersection logic to check for non-null C2dint1 when determining periodicity of 3D curves.
- Improved robustness of the PerformIntersectionAtEnd function to prevent potential issues with null parameters.
- Added a helper function to create B-spline curves from poles and knot sequences.
- Introduced a new test case to validate ThruSections with B-spline profiles of varying pole counts.
- Ensured compatibility of closed B-spline curves during lofting operations.
- Improved test coverage for the BRepOffsetAPI_ThruSections functionality.
- Fixed CheckMixedContinuity to detect actual mixed concavity
(both convex and concave regions) instead of any G1/non-G1 transitions
- Added null edge and PCurve checks in RefEdgeInter to prevent crashes
- Added GTests for BRepOffset_MakeOffset covering various loft scenarios
- Introduced StringViewHasher for efficient hashing of std::string_view using OCCT utilities.
- Updated THE_TYPENUMS and THE_TYPESHOR maps to utilize StringViewDataMap with the new hasher.
- Modified initialization functions to accept the new map type for better type safety and clarity.
- Replacing preprocessor-based generic programming with C++ templates
- Converting inline implementation files (`.lxx`) to inline definitions within header files
- Removing legacy instantiation files (`_0.cxx`)
- Updating type aliases to use modern `using` declarations instead of macro-based instantiation
- Updated CSLib_Class2d to enhance documentation and improve parameter types for constructors.
- Refined point classification methods with clearer return types and improved comments.
- Modified CSLib_DerivativeStatus to clarify the status of surface derivatives computation.
- Enhanced CSLib_NormalPolyDef for better readability and efficiency in polynomial evaluations.
- Updated CSLib_NormalStatus to provide clearer descriptions of normal computation statuses.
- Updated point classification methods to return clearer result types.
- Enhanced input validation and array management for polygon vertices.
- Improved documentation for methods and parameters.
- Refactored internal methods for consistency and readability.
- Replaced manual absolute value logic (conditional negation) with `std::abs` for clarity
- Added `const` qualifiers to variables that are not modified after initialization
- Moved variable declarations closer to their first use and removed unused variable assignments
- Added flags to suppress elaborated-enum-base warnings for newer Clang versions on macOS
- Updated includes in TDF_AttributeMap.hxx to include Standard_Handle.hxx
- Modified hash functions in GeomHash and Geom2dHash classes to use Standard_CStringHasher instead of Standard_HashUtils
- Modified parameter validation to allow curves where `theUFirst > theULast` within `Precision::Confusion()` tolerance
- Updated documentation to reflect the new tolerance-based validation
- Added comprehensive test suites for both 2D and 3D curve adaptors
- Updates VCPKG baseline and version tag to 2025.10.17
- Adds new VCPKG install options for exact version matching and post-build cleanup
- Adds macOS build dependencies (autoconf-archive and libtool)
- Removes obsolete compiler version checks (SSE2 for VS 2005-2010, GCC 4.6 deprecation warnings)
- Replaces deprecated CMake variables `CMAKE_COMPILER_IS_GNUCC/GNUCXX` with modern `CMAKE_CXX_COMPILER_ID`
- Adds production optimizations: aggressive inlining, linker optimizations, and security hardening flags
- Establishes explicit job dependencies to prevent redundant workflow runs
- Adds GTest execution for macOS with Clang (No PCH) in Debug mode
- Creates a dependency chain where macOS Clang (No PCH) builds depend on standard macOS builds
- Introduced a separate temporary allocator (`aTmpAllocator`) for per-iteration collections
- Reorganized collection declarations to distinguish between temporary (per-iteration) and persistent (cross-iteration) data structures
- Added allocator reset logic at the start of each iteration to reclaim memory
- Added null checks for 2D curve handles to prevent dereferencing null geometry
- Refactored `ProcessDE()` to use modern C++ idioms (auto, structured bindings, range-based iteration patterns)
- Simplified `FindPaveBlocks()` using a lambda function to reduce code duplication
- Refactored the `ReorderFaces` function to iterate through all edges at a vertex instead of assuming only two edges exist
- Replaced manual face swapping with `std::swap` for cleaner code
- Removed debug output statements and unused debug declarations
- Fix negative modulo in torus bounding box computation
- Fix hyperbola extrema loop early break condition
- Fix OpenMin/OpenMax direction sign for infinite bounds
- Remove dead code in cone bounding computation
- Replace sqrt/log with more efficient computations in hyperbola bounds
- General code cleanup and modernization
- Replaced `Graphic3d_Vec3d` and `Graphic3d_Vec4d` with generic `BVH_VecNt` and `BVH::VectorType<T, 4>::Type`
- Changed `Standard_Integer` and `Standard_Real` to template type `T` and `int` for generic implementation
- Added comprehensive test coverage for float-precision transformations
- Fixed multiple bugs including uninitialized variables (zmin/zmax in IsOut(gp_Lin)), incorrect type usage (Standard_Integer → Standard_Boolean), and improper gap handling
- Optimized performance-critical methods through branchless operations, early exits, and cached computations
- Modernized codebase with C++17 features including constexpr constructors, noexcept specifications, and [[nodiscard]] attributes
- Refactor Bnd_Box and Bnd_Box2d classes to introduce GetXMin, GetXMax, GetYMin, GetYMax, and GetZMin,
GetZMax methods for improved clarity and encapsulation.
- Add Limits struct to represent box limits in both classes.
- Performance optimizations including binary exponentiation for `Powered()`, optimized hash code computation, and fast-path optimizations for common operations
- Code modernization with `noexcept` qualifiers, `constexpr` for compile-time constants, and inline wrapper methods