Skip to content

Modeling Data - Add GeomHash and Geom2dHash packages#845

Merged
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:geom_cache_feat
Nov 22, 2025
Merged

Modeling Data - Add GeomHash and Geom2dHash packages#845
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:geom_cache_feat

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

Introduces new hash and comparison functionality for geometric objects:

  • TKG3d/GeomHash - GeomHash_CurveHasher and GeomHash_SurfaceHasher classes for 3D geometry
  • TKG2d/Geom2dHash - Geom2dHash_CurveHasher class for 2D geometry

These classes provide efficient hashing and deep comparison for geometry deduplication and caching.

Implementation Details

GeomHash_CurveHasher: Hash/comparison for 3D curves

  • Analytic curves: Line, Circle, Ellipse, Hyperbola, Parabola
  • Freeform curves: BezierCurve, BSplineCurve
  • Derived curves: TrimmedCurve, OffsetCurve

GeomHash_SurfaceHasher: Hash/comparison for 3D surfaces

  • Elementary surfaces: Plane, Cylinder, Cone, Sphere, Torus
  • Freeform surfaces: BezierSurface, BSplineSurface
  • Derived surfaces: SurfaceOfRevolution, SurfaceOfLinearExtrusion, RectangularTrimmedSurface, OffsetSurface

Geom2dHash_CurveHasher: Hash/comparison for 2D curves

  • Same curve types as 3D, adapted for 2D geometry

- Implemented GeomHash_OffsetCurveHasher for hashing and comparing offset curves.
- Implemented GeomHash_OffsetSurfaceHasher for hashing and comparing offset surfaces.
- Implemented GeomHash_ParabolaHasher for hashing and comparing parabolas.
- Implemented GeomHash_PlaneHasher for hashing and comparing planes.
- Implemented GeomHash_PointHasher for hashing and comparing 3D points.
- Implemented GeomHash_RectangularTrimmedSurfaceHasher for hashing and comparing trimmed surfaces.
- Implemented GeomHash_SphericalSurfaceHasher for hashing and comparing spherical surfaces.
- Implemented GeomHash_SurfaceHasher for polymorphic hashing of surfaces.
- Implemented GeomHash_SurfaceOfLinearExtrusionHasher for hashing and comparing linear extrusion surfaces.
- Implemented GeomHash_SurfaceOfRevolutionHasher for hashing and comparing revolution surfaces.
- Implemented GeomHash_ToroidalSurfaceHasher for hashing and comparing toroidal surfaces.
- Implemented GeomHash_TrimmedCurveHasher for hashing and comparing trimmed curves.
- Implemented GeomHash_VectorHasher for hashing and comparing 3D vectors.
- Updated CMake configuration to include GeomHash package.
- Implemented tests for various geometric surfaces including Plane, CylindricalSurface, ConicalSurface, SphericalSurface, ToroidalSurface, BezierSurface, BSplineSurface, SurfaceOfRevolution, SurfaceOfLinearExtrusion, RectangularTrimmedSurface, and OffsetSurface.
- Verified that copied surfaces produce the same hash and comparison results.
- Ensured that different parameters (e.g., radius, angle, bounds, weights) yield different hashes and comparison results.
- Included tests for null surfaces and same object comparisons.
- Added cross-type comparison tests to validate behavior between different surface types.
@dpasukhi dpasukhi added this to the Release 8.0 milestone Nov 21, 2025
@dpasukhi dpasukhi self-assigned this Nov 21, 2025
@dpasukhi dpasukhi added 2. Enhancement New feature or request 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... labels Nov 21, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive hash and comparison functionality for OCCT geometric objects to enable efficient geometry deduplication and caching. It adds two new packages: GeomHash for 3D geometry and Geom2dHash for 2D geometry, both providing type-specific hashers for curves and surfaces that support polymorphic dispatch via RTTI.

Key changes:

  • Implementation of hashers for analytic curves (Line, Circle, Ellipse, Hyperbola, Parabola) and freeform curves (Bezier, BSpline, Trimmed, Offset) in both 2D and 3D
  • Implementation of hashers for surfaces including elementary surfaces (Plane, Cylinder, Cone, Sphere, Torus) and derived surfaces (Revolution, LinearExtrusion, RectangularTrimmed, Offset)
  • Comprehensive test coverage for all hasher implementations

Reviewed changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ModelingData/TKG3d/PACKAGES.cmake Adds GeomHash package to TKG3d toolkit
src/ModelingData/TKG3d/GeomHash/*.pxx Implements 3D geometry hashers for foundational types, curves, and surfaces
src/ModelingData/TKG3d/GeomHash/.hxx/.cxx Public API for polymorphic curve and surface hashers
src/ModelingData/TKG3d/GeomHash/FILES.cmake Lists all GeomHash package source files
src/ModelingData/TKG3d/GTests/*_Test.cxx Comprehensive unit tests for 3D hashers
src/ModelingData/TKG3d/GTests/FILES.cmake Adds test files to build system
src/ModelingData/TKG2d/PACKAGES.cmake Adds Geom2dHash package to TKG2d toolkit
src/ModelingData/TKG2d/Geom2dHash/*.pxx Implements 2D geometry hashers (parallel to 3D)
src/ModelingData/TKG2d/Geom2dHash/.hxx/.cxx Public API for polymorphic 2D curve hashers
src/ModelingData/TKG2d/Geom2dHash/FILES.cmake Lists all Geom2dHash package source files
src/ModelingData/TKG2d/GTests/Geom2dHash_CurveHasher_Test.cxx Comprehensive unit tests for 2D hashers
src/ModelingData/TKG2d/GTests/FILES.cmake Adds 2D test files to build system

@dpasukhi dpasukhi merged commit 052c376 into Open-Cascade-SAS:IR Nov 22, 2025
44 of 46 checks passed
@dpasukhi dpasukhi deleted the geom_cache_feat branch November 22, 2025 11:16
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants