Commit Graph

35 Commits

Author SHA1 Message Date
Petru Conduraru 8a5b1ab10d ifcgeom: prototype OpenCascade kernel support for point/vertex representations
Exploratory proof of concept for #134, #1409 and #5218: IfcVertexPoint,
IfcCartesianPoint and IfcCartesianPointList3D used as top-level
representation items ("Vertex"/"Point"/"PointCloud") currently raise
"Failed to process shape" because AbstractKernel::convert_impl for
taxonomy::point3 is never implemented and point3 cannot appear as a
child of the generic items collection.

This makes point3/direction3 derive from geom_item instead of plain
item, so a lone point3 can stand in as a representation item, and adds:

- OpenCascadeKernel::convert_impl(point3): a single point becomes a
  TopoDS_Vertex wrapped in a TopoDS_Compound, as aothms suggested in
  #5218.
- OpenCascadeKernel::convert_impl(collection): a bulk fast path for a
  collection made up entirely of point3 children (e.g. a whole
  IfcCartesianPointList3D) that builds ONE compound with all vertices
  in a single pass, instead of paying the generic per-item conversion
  overhead (cache lookup, heap allocation, a separate Triangulate()
  call) once per point.
- mapping for IfcVertexPoint (as a top-level item) and
  IfcCartesianPointList3D.
- loose-vertex emission in OpenCascadeShape::Triangulate, since a
  vertex-only shape previously triangulated to nothing.

This directly tests aothms's "the overhead is enormous" concern from
#5218. Benchmarked on this machine (Apple M-series, Release build):

- Normal (non-point) geometry is unaffected: a 5178-shape real model
  processes in 4.48s before this change and 4.49s after (~0.3%, noise).
- The bulk fast path scales linearly and cheaply: ~0.5-0.9 us/point for
  an IfcCartesianPointList3D from 1k to 100k points (100k points in
  ~93ms total).
- With the fast path disabled (pure per-item conversion, i.e. the naive
  reading of "a TopoDS_Compound of TopoDS_Vertex" with no batching),
  scaling is still linear, not quadratic, but ~4-7x slower per point
  (~3.5-4 us/point at the same scale, 100k points in ~380ms).

So aothms's concern is real as a constant-factor tax from going through
full OCCT BRep objects (TopoDS_Vertex/Compound, shared_ptr taxonomy
nodes, per-item caching) rather than flat coordinate arrays, but it is
not the asymptotic blowup "enormous overhead" might suggest, and a
reasonably-scoped batching fast path narrows the gap substantially.
Given Bonsai already has a working, accepted Python-side bypass for
this (create_point_cloud_mesh / create_structural_point_connection_mesh
in bonsai/tool/loader.py and geometry.py), this is offered as a
proof of concept for evaluation, not a claim that it should override
the prior "something for 0.9" call.

IfcCartesianPointList2D ("PointCloud" in 2D) is intentionally out of
scope for this prototype.

Adds pytest coverage (no Catch2/C++ test harness exists in this
codebase) for all three representation types plus a 1000-point
round-trip/timing sanity check.

Generated with the assistance of an AI coding tool.
2026-07-21 22:51:44 +03:00
Thomas Krijnen b4d7780e14 Use opencascade::handle for compatibility with earlier versions 2026-06-29 11:30:37 +02:00
Frozen Forest Reality Technologies 81f71e6418 OCCT 8.0 Update Part 2 2026-06-29 11:30:36 +02:00
Frozen Forest Reality Technologies 6318610bdb OCCT Update to 8.0 Part 1 2026-06-29 11:30:36 +02:00
Thomas Krijnen c592018b3f Minor changes to conversion result numbers 2026-06-23 20:25:57 +02:00
Thomas Krijnen 4f21bd1c69 Auto mem mngt in conversion result number types; more arithmetic on OpaqueCoordinate 2026-06-22 10:38:25 +02:00
Thomas Krijnen 669e04664d Consistent policy on normalization in halfspace eq map() 2026-06-20 13:30:17 +02:00
Thomas Krijnen a7738eeb64 Pass around non-static logger instances and programmatic access to messages in-memory 2026-06-10 18:40:17 +02:00
Thomas Krijnen a751fb956d Introduce unique error codes 2026-06-10 18:40:17 +02:00
Thomas Krijnen d684d47dc8 Make sure compound structure is retained as SvgSerializer depends on it 2025-10-01 15:01:50 +02:00
Thomas Krijnen ce91d296b6 dllimport/export #6926 2025-09-26 14:24:49 +02:00
Thomas Krijnen 439f9c14ce OcctNoCleanTriangulation CacheShapes PermissiveShapeReuse setting; Cgal conditional copy during triangulation; occt cheaper check for triangulation existance #6712 2025-05-18 22:14:22 +02:00
Thomas Krijnen 21d39d8a23 Use exact topology points at parametric range bounds to guarantee welding #4487 2025-04-18 10:08:57 +02:00
Thomas Krijnen ecba1c3e7b Fix for UVs in python binding #5592 2024-10-18 10:37:53 +02:00
Thomas Krijnen a04912e174 Assure edges are emitted in some topological order 2024-10-17 14:35:17 +02:00
Thomas Krijnen 07fda60794 Return edges as planar-component boundaries in CGAL #5485 2024-10-04 19:11:02 +02:00
Andrej730 dd9de98290 Store edges representation item ids in Triangulation 2024-09-25 19:09:14 +05:00
Andrej730 aad66f94a3 rename addEdge overload to registerEdgeCount
So it won't be confused with addEdge that actually does add an edge to edges_.
2024-09-25 19:09:14 +05:00
Thomas Krijnen 2554280e50 triangulation-type setting for non-triangulated polyhedral from iterator 2024-09-18 19:28:07 +02:00
Thomas Krijnen 88c8bcf119 Pin OCCT serialization version to v2 #4393 2024-06-19 14:44:52 +02:00
Thomas Krijnen f6a0d1f073 Fix #4273 ignore degenerate triangles in mesher output 2024-04-18 10:47:23 +02:00
Thomas Krijnen 1f4b12443a fix edge segments in world coords #3536 2024-04-16 10:24:43 +02:00
Thomas Krijnen ee09f2404b Filter duplicate edge indices #3546 2024-04-16 10:22:34 +02:00
Thomas Krijnen 20f279dfa3 IFC4X3 codegen #2805 2024-04-15 13:24:59 +02:00
Thomas Krijnen dc81be8a9a item_id vector #3120 2024-04-15 13:02:45 +02:00
Thomas Krijnen bf1d2befd8 Address compiler warnings 2024-03-14 11:10:19 +01:00
Thomas Krijnen 6ed91d3ea4 to_string() option, no shared_ptr in OpaqueCoord, add ConvResShape::vertices(), newell instead of simple cross product, create_epeck(double/str) 2023-12-13 16:43:33 +01:00
Thomas Krijnen 137a6b5706 map(vector<opaque_4>) prototype 2023-12-11 21:03:55 +01:00
Thomas Krijnen 65e874c67f Drastic settings refactoring 2023-11-15 10:32:33 +01:00
Thomas Krijnen 809668c015 Major update to halfspace algorithm, conversion result shape analysis 2023-11-02 09:04:34 +01:00
Thomas Krijnen 4bb3cc5c90 Fix transformation in serialization element, accept geometry library in more geom functions 2023-08-26 11:35:23 +02:00
Thomas Krijnen 5336b2f987 Implement shape serialization for cgal, possibility to supply geometry library to iterator in py 2023-08-25 21:46:32 +02:00
Thomas Krijnen 65a5646bf0 Major update: taxonomy shared pointers, collection type safety, work towards hashing 2023-07-27 16:42:06 +08:00
Thomas Krijnen 933f7fced2 Merge OCCT 7.6+ compatibility 2023-04-09 19:28:37 +00:00
Thomas Krijnen c78b2893de Proceed with merge 2023-03-21 20:15:01 +01:00