@bldrs-ai/conway 1.389.1221 → 1.394.1504

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +36 -22
  2. package/compiled/Dist/ConwayGeomWasmNode.js +0 -0
  3. package/compiled/Dist/ConwayGeomWasmNodeMT.js +0 -0
  4. package/compiled/Dist/ConwayGeomWasmWeb.js +0 -0
  5. package/compiled/Dist/ConwayGeomWasmWebMT.js +1 -1
  6. package/compiled/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  7. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +0 -0
  8. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +0 -0
  9. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +0 -0
  10. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
  11. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  12. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +19 -0
  13. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
  14. package/compiled/dependencies/conway-geom/interface/conway_geometry.js +17 -0
  15. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts +6 -0
  16. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts.map +1 -1
  17. package/compiled/examples/browser-bundled.cjs +1569 -51
  18. package/compiled/examples/cli-bundled.cjs +2790 -436
  19. package/compiled/examples/cli-step-bundled.cjs +1904 -229
  20. package/compiled/examples/validator-bundled.cjs +1569 -51
  21. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
  22. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
  23. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
  24. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
  25. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
  26. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
  27. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
  28. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
  29. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
  30. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
  31. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
  32. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
  33. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
  34. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
  35. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
  36. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
  37. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
  38. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
  39. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.d.ts.map +1 -1
  40. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.js +2 -2
  41. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
  42. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
  43. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
  44. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
  45. package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
  46. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +181 -7
  47. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
  48. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +906 -137
  49. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +10 -2
  50. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
  51. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
  52. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
  53. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts +6 -0
  54. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts.map +1 -1
  55. package/compiled/src/AP214E3_2010/ap214_model_geometry.js +9 -0
  56. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
  57. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
  58. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
  59. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts +2 -0
  60. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts.map +1 -0
  61. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.js +147 -0
  62. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts +2 -1
  63. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts.map +1 -1
  64. package/compiled/src/AP214E3_2010/ap214_step_model.js +1 -1
  65. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts +2 -0
  66. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts.map +1 -0
  67. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.js +65 -0
  68. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts +2 -0
  69. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts.map +1 -0
  70. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.js +111 -0
  71. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts +2 -0
  72. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts.map +1 -0
  73. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.js +190 -0
  74. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts +2 -0
  75. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts.map +1 -0
  76. package/compiled/src/compat/web-ifc/coordination_export_order.test.js +110 -0
  77. package/compiled/src/compat/web-ifc/coordination_f64.d.ts +165 -0
  78. package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -0
  79. package/compiled/src/compat/web-ifc/coordination_f64.js +286 -0
  80. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts +2 -0
  81. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts.map +1 -0
  82. package/compiled/src/compat/web-ifc/coordination_f64.test.js +225 -0
  83. package/compiled/src/compat/web-ifc/ifc_api.d.ts +154 -0
  84. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  85. package/compiled/src/compat/web-ifc/ifc_api.js +211 -3
  86. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts +2 -0
  87. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts.map +1 -0
  88. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +288 -0
  89. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +39 -0
  90. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  91. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +30 -0
  92. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
  93. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +83 -0
  94. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts +2 -0
  95. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts.map +1 -0
  96. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +383 -0
  97. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts +2 -0
  98. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts.map +1 -0
  99. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.js +124 -0
  100. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +132 -0
  101. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  102. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +488 -92
  103. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +268 -0
  104. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  105. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +996 -149
  106. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts +2 -0
  107. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts.map +1 -0
  108. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +129 -0
  109. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
  110. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
  111. package/compiled/src/compat/web-ifc/spatial_imposter.js +933 -0
  112. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
  113. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
  114. package/compiled/src/compat/web-ifc/spatial_imposter.test.js +467 -0
  115. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +187 -0
  116. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
  117. package/compiled/src/compat/web-ifc/store_preview_channel.js +524 -0
  118. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
  119. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
  120. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +234 -0
  121. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +306 -0
  122. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -0
  123. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +580 -0
  124. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts +2 -0
  125. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts.map +1 -0
  126. package/compiled/src/compat/web-ifc/web_wasm_directory.test.js +22 -0
  127. package/compiled/src/core/composed_model_skeleton.d.ts +63 -0
  128. package/compiled/src/core/composed_model_skeleton.d.ts.map +1 -0
  129. package/compiled/src/core/composed_model_skeleton.js +66 -0
  130. package/compiled/src/core/composed_model_skeleton.test.d.ts +2 -0
  131. package/compiled/src/core/composed_model_skeleton.test.d.ts.map +1 -0
  132. package/compiled/src/core/composed_model_skeleton.test.js +69 -0
  133. package/compiled/src/core/demand_geometry_queue.d.ts +147 -0
  134. package/compiled/src/core/demand_geometry_queue.d.ts.map +1 -0
  135. package/compiled/src/core/demand_geometry_queue.js +223 -0
  136. package/compiled/src/core/demand_geometry_queue.test.d.ts +2 -0
  137. package/compiled/src/core/demand_geometry_queue.test.d.ts.map +1 -0
  138. package/compiled/src/core/demand_geometry_queue.test.js +133 -0
  139. package/compiled/src/core/demand_residency_pump.d.ts +93 -0
  140. package/compiled/src/core/demand_residency_pump.d.ts.map +1 -0
  141. package/compiled/src/core/demand_residency_pump.js +120 -0
  142. package/compiled/src/core/demand_residency_pump.test.d.ts +2 -0
  143. package/compiled/src/core/demand_residency_pump.test.d.ts.map +1 -0
  144. package/compiled/src/core/demand_residency_pump.test.js +148 -0
  145. package/compiled/src/core/geometry_tile_bindings.d.ts +110 -0
  146. package/compiled/src/core/geometry_tile_bindings.d.ts.map +1 -0
  147. package/compiled/src/core/geometry_tile_bindings.js +76 -0
  148. package/compiled/src/core/geometry_tile_bindings.test.d.ts +2 -0
  149. package/compiled/src/core/geometry_tile_bindings.test.d.ts.map +1 -0
  150. package/compiled/src/core/geometry_tile_bindings.test.js +211 -0
  151. package/compiled/src/core/geometry_tile_pool.d.ts +99 -0
  152. package/compiled/src/core/geometry_tile_pool.d.ts.map +1 -0
  153. package/compiled/src/core/geometry_tile_pool.js +104 -0
  154. package/compiled/src/core/geometry_tile_pool.test.d.ts +2 -0
  155. package/compiled/src/core/geometry_tile_pool.test.d.ts.map +1 -0
  156. package/compiled/src/core/geometry_tile_pool.test.js +180 -0
  157. package/compiled/src/core/mem/chunked_pool.d.ts +116 -0
  158. package/compiled/src/core/mem/chunked_pool.d.ts.map +1 -0
  159. package/compiled/src/core/mem/chunked_pool.js +149 -0
  160. package/compiled/src/core/mem/chunked_pool.test.d.ts +2 -0
  161. package/compiled/src/core/mem/chunked_pool.test.d.ts.map +1 -0
  162. package/compiled/src/core/mem/chunked_pool.test.js +63 -0
  163. package/compiled/src/core/mem/shared_asset_pool.d.ts +82 -0
  164. package/compiled/src/core/mem/shared_asset_pool.d.ts.map +1 -0
  165. package/compiled/src/core/mem/shared_asset_pool.js +113 -0
  166. package/compiled/src/core/mem/shared_asset_pool.test.d.ts +2 -0
  167. package/compiled/src/core/mem/shared_asset_pool.test.d.ts.map +1 -0
  168. package/compiled/src/core/mem/shared_asset_pool.test.js +49 -0
  169. package/compiled/src/core/model_registry.d.ts +87 -0
  170. package/compiled/src/core/model_registry.d.ts.map +1 -0
  171. package/compiled/src/core/model_registry.js +101 -0
  172. package/compiled/src/core/model_registry.test.d.ts +2 -0
  173. package/compiled/src/core/model_registry.test.d.ts.map +1 -0
  174. package/compiled/src/core/model_registry.test.js +60 -0
  175. package/compiled/src/core/model_uri.d.ts +57 -0
  176. package/compiled/src/core/model_uri.d.ts.map +1 -0
  177. package/compiled/src/core/model_uri.js +101 -0
  178. package/compiled/src/core/model_uri.test.d.ts +2 -0
  179. package/compiled/src/core/model_uri.test.d.ts.map +1 -0
  180. package/compiled/src/core/model_uri.test.js +49 -0
  181. package/compiled/src/core/progress.d.ts +16 -2
  182. package/compiled/src/core/progress.d.ts.map +1 -1
  183. package/compiled/src/core/progress.js +31 -5
  184. package/compiled/src/core/progress.test.js +11 -2
  185. package/compiled/src/core/progress_log.d.ts +1 -0
  186. package/compiled/src/core/progress_log.d.ts.map +1 -1
  187. package/compiled/src/core/progress_log.js +7 -2
  188. package/compiled/src/core/progress_log.test.js +21 -0
  189. package/compiled/src/core/shared_byte_budget.d.ts +60 -0
  190. package/compiled/src/core/shared_byte_budget.d.ts.map +1 -0
  191. package/compiled/src/core/shared_byte_budget.js +85 -0
  192. package/compiled/src/core/shared_byte_budget.test.d.ts +2 -0
  193. package/compiled/src/core/shared_byte_budget.test.d.ts.map +1 -0
  194. package/compiled/src/core/shared_byte_budget.test.js +55 -0
  195. package/compiled/src/core/wasm_heap.d.ts +208 -0
  196. package/compiled/src/core/wasm_heap.d.ts.map +1 -0
  197. package/compiled/src/core/wasm_heap.js +417 -0
  198. package/compiled/src/core/wasm_heap.test.d.ts +2 -0
  199. package/compiled/src/core/wasm_heap.test.d.ts.map +1 -0
  200. package/compiled/src/core/wasm_heap.test.js +546 -0
  201. package/compiled/src/demand/index.d.ts +23 -0
  202. package/compiled/src/demand/index.d.ts.map +1 -0
  203. package/compiled/src/demand/index.js +22 -0
  204. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
  205. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
  206. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
  207. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.d.ts.map +1 -1
  208. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.js +2 -2
  209. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
  210. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
  211. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
  212. package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
  213. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts +2 -0
  214. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts.map +1 -0
  215. package/compiled/src/ifc/ifc_demand_extraction.test.js +251 -0
  216. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +367 -6
  217. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  218. package/compiled/src/ifc/ifc_geometry_extraction.js +1322 -389
  219. package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
  220. package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
  221. package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
  222. package/compiled/src/ifc/ifc_model_geometry.d.ts +12 -0
  223. package/compiled/src/ifc/ifc_model_geometry.d.ts.map +1 -1
  224. package/compiled/src/ifc/ifc_model_geometry.js +15 -0
  225. package/compiled/src/ifc/ifc_regression_batch_main.js +210 -12
  226. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts +145 -0
  227. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts.map +1 -0
  228. package/compiled/src/ifc/ifc_spatial_skeleton.js +266 -0
  229. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts +2 -0
  230. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts.map +1 -0
  231. package/compiled/src/ifc/ifc_spatial_skeleton.test.js +199 -0
  232. package/compiled/src/ifc/ifc_step_model.d.ts +6 -2
  233. package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
  234. package/compiled/src/ifc/ifc_step_model.js +6 -4
  235. package/compiled/src/ifc/ifc_step_parser.d.ts +58 -0
  236. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  237. package/compiled/src/ifc/ifc_step_parser.js +64 -0
  238. package/compiled/src/ifc/ifc_stream_model.test.d.ts +2 -0
  239. package/compiled/src/ifc/ifc_stream_model.test.d.ts.map +1 -0
  240. package/compiled/src/ifc/ifc_stream_model.test.js +70 -0
  241. package/compiled/src/ifc/ifc_stream_open.d.ts +131 -0
  242. package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -0
  243. package/compiled/src/ifc/ifc_stream_open.js +116 -0
  244. package/compiled/src/ifc/ifc_stream_open.test.d.ts +2 -0
  245. package/compiled/src/ifc/ifc_stream_open.test.d.ts.map +1 -0
  246. package/compiled/src/ifc/ifc_stream_open.test.js +230 -0
  247. package/compiled/src/ifc/ifc_tile_extractor.d.ts +84 -0
  248. package/compiled/src/ifc/ifc_tile_extractor.d.ts.map +1 -0
  249. package/compiled/src/ifc/ifc_tile_extractor.js +134 -0
  250. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts +2 -0
  251. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts.map +1 -0
  252. package/compiled/src/ifc/ifc_tile_extractor.test.js +118 -0
  253. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts +2 -0
  254. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts.map +1 -0
  255. package/compiled/src/ifc/ifc_typed_select_enum.test.js +60 -0
  256. package/compiled/src/index.d.ts +21 -1
  257. package/compiled/src/index.d.ts.map +1 -1
  258. package/compiled/src/index.js +28 -1
  259. package/compiled/src/logging/logger.d.ts +16 -2
  260. package/compiled/src/logging/logger.d.ts.map +1 -1
  261. package/compiled/src/logging/logger.js +34 -7
  262. package/compiled/src/logging/logger.test.js +30 -0
  263. package/compiled/src/mem/index.d.ts +17 -0
  264. package/compiled/src/mem/index.d.ts.map +1 -0
  265. package/compiled/src/mem/index.js +16 -0
  266. package/compiled/src/namespace_surface.test.d.ts +2 -0
  267. package/compiled/src/namespace_surface.test.d.ts.map +1 -0
  268. package/compiled/src/namespace_surface.test.js +43 -0
  269. package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
  270. package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
  271. package/compiled/src/parsing/parsing_buffer.js +31 -0
  272. package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
  273. package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
  274. package/compiled/src/scripts/model_report_displacement.test.js +104 -0
  275. package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
  276. package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
  277. package/compiled/src/scripts/render_glb_paths.test.js +115 -0
  278. package/compiled/src/step/indexing/step_type_indexer.d.ts +20 -0
  279. package/compiled/src/step/indexing/step_type_indexer.d.ts.map +1 -1
  280. package/compiled/src/step/indexing/step_type_indexer.js +67 -0
  281. package/compiled/src/step/parsing/byte_source.d.ts +153 -0
  282. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
  283. package/compiled/src/step/parsing/byte_source.js +106 -0
  284. package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
  285. package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
  286. package/compiled/src/step/parsing/byte_source.test.js +47 -0
  287. package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
  288. package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
  289. package/compiled/src/step/parsing/byte_source_node.js +54 -0
  290. package/compiled/src/step/parsing/columnar_index.d.ts +103 -0
  291. package/compiled/src/step/parsing/columnar_index.d.ts.map +1 -0
  292. package/compiled/src/step/parsing/columnar_index.js +224 -0
  293. package/compiled/src/step/parsing/columnar_index.test.d.ts +2 -0
  294. package/compiled/src/step/parsing/columnar_index.test.d.ts.map +1 -0
  295. package/compiled/src/step/parsing/columnar_index.test.js +155 -0
  296. package/compiled/src/step/parsing/cross_reference_registry.d.ts +95 -0
  297. package/compiled/src/step/parsing/cross_reference_registry.d.ts.map +1 -0
  298. package/compiled/src/step/parsing/cross_reference_registry.js +91 -0
  299. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts +2 -0
  300. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts.map +1 -0
  301. package/compiled/src/step/parsing/cross_reference_registry.test.js +66 -0
  302. package/compiled/src/step/parsing/decode_utf8.d.ts +15 -0
  303. package/compiled/src/step/parsing/decode_utf8.d.ts.map +1 -1
  304. package/compiled/src/step/parsing/decode_utf8.js +28 -0
  305. package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
  306. package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
  307. package/compiled/src/step/parsing/express_ref_scan.js +91 -0
  308. package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
  309. package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
  310. package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
  311. package/compiled/src/step/parsing/index_sidecar.d.ts +81 -0
  312. package/compiled/src/step/parsing/index_sidecar.d.ts.map +1 -0
  313. package/compiled/src/step/parsing/index_sidecar.js +283 -0
  314. package/compiled/src/step/parsing/index_sidecar.test.d.ts +2 -0
  315. package/compiled/src/step/parsing/index_sidecar.test.d.ts.map +1 -0
  316. package/compiled/src/step/parsing/index_sidecar.test.js +122 -0
  317. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts +2 -0
  318. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts.map +1 -0
  319. package/compiled/src/step/parsing/inf_recovery_index.test.js +108 -0
  320. package/compiled/src/step/parsing/prefix_type_index.d.ts +124 -0
  321. package/compiled/src/step/parsing/prefix_type_index.d.ts.map +1 -0
  322. package/compiled/src/step/parsing/prefix_type_index.js +207 -0
  323. package/compiled/src/step/parsing/prefix_type_index.test.d.ts +2 -0
  324. package/compiled/src/step/parsing/prefix_type_index.test.d.ts.map +1 -0
  325. package/compiled/src/step/parsing/prefix_type_index.test.js +298 -0
  326. package/compiled/src/step/parsing/range_byte_source.d.ts +69 -0
  327. package/compiled/src/step/parsing/range_byte_source.d.ts.map +1 -0
  328. package/compiled/src/step/parsing/range_byte_source.js +78 -0
  329. package/compiled/src/step/parsing/range_byte_source.test.d.ts +2 -0
  330. package/compiled/src/step/parsing/range_byte_source.test.d.ts.map +1 -0
  331. package/compiled/src/step/parsing/range_byte_source.test.js +70 -0
  332. package/compiled/src/step/parsing/record_event.d.ts +23 -0
  333. package/compiled/src/step/parsing/record_event.d.ts.map +1 -0
  334. package/compiled/src/step/parsing/record_event.js +1 -0
  335. package/compiled/src/step/parsing/record_field_cursor.d.ts +94 -0
  336. package/compiled/src/step/parsing/record_field_cursor.d.ts.map +1 -0
  337. package/compiled/src/step/parsing/record_field_cursor.js +189 -0
  338. package/compiled/src/step/parsing/step_deserialization_functions.d.ts +29 -0
  339. package/compiled/src/step/parsing/step_deserialization_functions.d.ts.map +1 -1
  340. package/compiled/src/step/parsing/step_deserialization_functions.js +45 -0
  341. package/compiled/src/step/parsing/step_deserialization_functions.test.js +59 -1
  342. package/compiled/src/step/parsing/step_parser.d.ts +66 -1
  343. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  344. package/compiled/src/step/parsing/step_parser.js +164 -10
  345. package/compiled/src/step/parsing/step_string_parser.js +8 -8
  346. package/compiled/src/step/parsing/streaming_index_builder.d.ts +141 -0
  347. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
  348. package/compiled/src/step/parsing/streaming_index_builder.js +280 -0
  349. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
  350. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
  351. package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
  352. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts +2 -0
  353. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts.map +1 -0
  354. package/compiled/src/step/parsing/streaming_index_builder_async.test.js +109 -0
  355. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts +71 -0
  356. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts.map +1 -0
  357. package/compiled/src/step/parsing/streaming_record_dispatcher.js +88 -0
  358. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts +2 -0
  359. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts.map +1 -0
  360. package/compiled/src/step/parsing/streaming_record_dispatcher.test.js +66 -0
  361. package/compiled/src/step/parsing/uint32_sink.d.ts +72 -0
  362. package/compiled/src/step/parsing/uint32_sink.d.ts.map +1 -0
  363. package/compiled/src/step/parsing/uint32_sink.js +180 -0
  364. package/compiled/src/step/parsing/uint32_sink.test.d.ts +2 -0
  365. package/compiled/src/step/parsing/uint32_sink.test.d.ts.map +1 -0
  366. package/compiled/src/step/parsing/uint32_sink.test.js +199 -0
  367. package/compiled/src/step/step_buffer_provider.d.ts +48 -3
  368. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  369. package/compiled/src/step/step_buffer_provider.js +60 -11
  370. package/compiled/src/step/step_buffer_provider.test.js +14 -0
  371. package/compiled/src/step/step_entity_base.d.ts +65 -3
  372. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  373. package/compiled/src/step/step_entity_base.js +135 -3
  374. package/compiled/src/step/step_model_base.d.ts +221 -8
  375. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  376. package/compiled/src/step/step_model_base.js +542 -7
  377. package/compiled/src/stream/index.d.ts +34 -0
  378. package/compiled/src/stream/index.d.ts.map +1 -0
  379. package/compiled/src/stream/index.js +32 -0
  380. package/compiled/src/version/version.js +1 -1
  381. package/compiled/tsconfig.tsbuildinfo +1 -1
  382. package/package.json +16 -1
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Float64 coordinate-to-origin (COORDINATE_TO_ORIGIN) math.
3
+ *
4
+ * gl-matrix's `mat4`/`vec4` are backed by `Float32Array`
5
+ * (`ARRAY_TYPE = Float32Array` in gl-matrix/common.js), so the recentre
6
+ * derivation — which subtracts a large world reference point
7
+ * (`transformedPt = placement * nativePoint`, on the order of 1e5 m for a
8
+ * Swiss/CHE georeferenced IFC, up to ~2.6e6 m in LV95 easting/northing) —
9
+ * loses precision: float32 ULP is ~7.6 mm at 100 km and ~60 mm at 2.6 M m.
10
+ * Baked into the emitted FlatMesh transform that quantization forms a
11
+ * spatial grid that reads as rotational jitter when the camera is zoomed
12
+ * to detail.
13
+ *
14
+ * The native placement crosses the wasm boundary as `glm::dmat4` and the
15
+ * reference point as `glm::dvec3` — both full float64 (see
16
+ * conway-api.cpp `getMatrixValues4x4` / the `glmdVec3` value object), so
17
+ * `nativeTransform.getValues()` and `geometry.getPoint()` deliver doubles.
18
+ * Feeding those doubles straight through a double-precision composition
19
+ * (rather than gl-matrix's float32 path, and without the intermediate
20
+ * `mat4.fromValues` truncation to `Float32Array`) fully recovers the
21
+ * precision for georeferenced models.
22
+ *
23
+ * All layout/multiply conventions match gl-matrix exactly (column-major,
24
+ * `out = a * b`), so near-origin models — where float32 and float64 agree
25
+ * to well under a micron — stay bit-comparable across the
26
+ * classic / deferred / preview paths that share this recentre.
27
+ */
28
+ /**
29
+ * The Z-up -> Y-up normalize matrix baked into every coordination frame
30
+ * (column-major).
31
+ *
32
+ * Every producer of a coordination frame MUST use the same matrix, or
33
+ * the frames it derives disagree with the durable walk's — which is
34
+ * exactly how the spatial-imposter plates ended up in a different space
35
+ * from the meshes (conway#515).
36
+ *
37
+ * This is the definition for everything that imports it: both preview
38
+ * channels and the spatial-imposter walk. Three identical literals
39
+ * remain, the public `NormalizeMat` field on `IfcAPI`, `IfcApiProxyIfc`
40
+ * and `IfcApiProxyAP214` — the web-ifc shim surface, typed
41
+ * `glmatrix.mat4`. They are the durable frame's producers, so they must
42
+ * stay bit-identical to this; folding them in is worth doing and was
43
+ * left out of conway#516 only to keep that diff to the imposter path.
44
+ */
45
+ export declare const NORMALIZE_MAT_F64: readonly number[];
46
+ /** Identity, for callers that need a "no coordination" frame. */
47
+ export declare const IDENTITY_MAT4: readonly number[];
48
+ /**
49
+ * A 3D point with double-precision components, as delivered by
50
+ * conway-geom's `getPoint` / `normalize` (glm::dvec3 across the boundary).
51
+ */
52
+ export interface Point3Like {
53
+ x: number;
54
+ y: number;
55
+ z: number;
56
+ }
57
+ /**
58
+ * Multiply two column-major 4x4 matrices in float64.
59
+ *
60
+ * Computes `out = a * b`, the identical formula (and operand order) to
61
+ * gl-matrix `mat4.multiply(out, a, b)`, but retaining double precision.
62
+ *
63
+ * @param a Left matrix (16 elements, column-major).
64
+ * @param b Right matrix (16 elements, column-major).
65
+ * @return {number[]} The product as a fresh 16-element `number[]`.
66
+ */
67
+ export declare function mat4MultiplyF64(a: ArrayLike<number>, b: ArrayLike<number>): number[];
68
+ /**
69
+ * Grid (metres) a recentre snaps to once it is needed at all.
70
+ *
71
+ * The anchor a recentre is derived from is the *first geometry* the walk
72
+ * reaches, which is an arbitrary interior element: whichever one the file
73
+ * happens to declare first. Left as-is, that makes a model's world
74
+ * position a function of its element order, with two consequences users
75
+ * see (conway#87, "not a sound basis for a camera in the permalink"):
76
+ *
77
+ * - Two exports of one object — the same logo as IFC and as STEP, a part
78
+ * re-exported by a different CAD kernel — land in different places,
79
+ * because they disagree about which element comes first. Share#1749
80
+ * hit exactly this: `index.step` sat 76m off `index.ifc` because the
81
+ * IFC declares the x=76 block first and the STEP the x=0 one.
82
+ * - Re-exporting a model with the element order shuffled moves it, so
83
+ * every camera permalink saved against it is silently wrong.
84
+ *
85
+ * `quantizeRecentre` answers that in two stages, because the two ranges
86
+ * want different things:
87
+ *
88
+ * - **Inside LARGE_COORDINATE_BUDGET_M, do not recentre at all.** There
89
+ * is no float32 benefit below the budget — that constant *is* the
90
+ * threshold where quantization becomes visible — so a model within
91
+ * 10km of the origin simply keeps the coordinates its file authored.
92
+ * That is model-zero, conway#87's proposal, and it makes the frame
93
+ * exactly order-independent for the overwhelming majority of models
94
+ * rather than order-independent-per-cell.
95
+ * - **Above it, snap to this grid.** A georeferenced model has to come
96
+ * back near the origin, and snapping keeps that repeatable across
97
+ * exports. Half a cell (500m) out of a 1e4 m budget costs ~0.05mm of
98
+ * float32 resolution, and a whole-kilometre translation is exactly
99
+ * representable where the raw anchor was not, so the recentre itself
100
+ * stops contributing rounding.
101
+ *
102
+ * **Quantizing cannot remove the discontinuity, only move it**, and it
103
+ * is worth being precise about where this one sits, because it is not
104
+ * where you would guess. Snapping *everything* to the grid would put a
105
+ * 1km step at every cell edge, including around the near-origin models
106
+ * that make up almost the whole corpus. Staging moves it to the budget:
107
+ * inside, every anchor derives model-zero and there is no edge at all;
108
+ * the single remaining edge is the budget itself, where the step is
109
+ * `LARGE_COORDINATE_BUDGET_M` (1e4), not the grid (1e3) — an anchor at
110
+ * 9900 derives zero and one at 10100 derives -10000.
111
+ *
112
+ * That edge is also invisible to the adopted-preview-frame gate, which
113
+ * re-derives only when a durable placement lands beyond the budget: a
114
+ * preview anchored at 10100 and a durable first placement at 9900 probe
115
+ * at ~100m, so the preview frame is kept and the model renders 10km off
116
+ * a classic open. The trade is deliberate — one edge that a georeferenced
117
+ * model may sit near, rather than an edge every kilometre through the
118
+ * range where nearly every model lives — but it is a real residual, not
119
+ * an eliminated one. design/new/coordination-frame.md tracks it, and
120
+ * conway#87's relative-to-centre direction is what removes it properly.
121
+ */
122
+ export declare const COORDINATION_SNAP_M = 1000;
123
+ /**
124
+ * Derive the coordination (recentre) matrix in float64, matching the
125
+ * gl-matrix op sequence exactly:
126
+ * `scale * NormalizeMat * translate(-quantize(placement * point))`.
127
+ *
128
+ * The quantization is what keeps the derived frame independent of which
129
+ * element a file declares first — see COORDINATION_SNAP_M for why that
130
+ * matters, and why it is staged around LARGE_COORDINATE_BUDGET_M.
131
+ *
132
+ * @param placement The native placement (16 elements, column-major
133
+ * float64 from `getValues()`); `undefined` is treated as identity.
134
+ * @param point The world reference point (`getPoint(0)`), float64.
135
+ * @param normalizeMat The Z-up -> Y-up normalize matrix (16 elements).
136
+ * @param scaleFactor The linear scaling factor.
137
+ * @return {number[]} The coordination matrix as a 16-element `number[]`.
138
+ */
139
+ export declare function deriveCoordinationF64(placement: ArrayLike<number> | undefined, point: Point3Like, normalizeMat: ArrayLike<number>, scaleFactor: number): number[];
140
+ /**
141
+ * Compose the emitted world transform in float64:
142
+ * `coordination * placement [ * translate(geomCenter) ]`.
143
+ *
144
+ * @param coordination The coordination matrix (16 elements).
145
+ * @param placement The native placement (16 elements, column-major
146
+ * float64 from `getValues()`); `undefined` is treated as identity.
147
+ * @param geomCenter The per-leaf normalize centre; omit for the bare
148
+ * composition used by the AP214 shared-buffer path (issue #308).
149
+ * @return {number[]} The flat transform as a 16-element `number[]`,
150
+ * ready to hand back as a FlatMesh `flatTransformation`.
151
+ */
152
+ export declare function composeTransformF64(coordination: ArrayLike<number>, placement: ArrayLike<number> | undefined, geomCenter?: Point3Like): number[];
153
+ export declare const TRANSLATION_X = 12;
154
+ export declare const TRANSLATION_Y = 13;
155
+ export declare const TRANSLATION_Z = 14;
156
+ /**
157
+ * Placement-magnitude budget (metres) above which a coordination frame
158
+ * has failed to recentre a model: float32 (the GPU vertex format and
159
+ * BatchedMesh matrix texture) quantizes at ~1mm per 1e4 m of
160
+ * coordinate, the visible-jitter threshold established in Share#1631.
161
+ * Used to validate an adopted preview coordination frame against the
162
+ * durable walk's first geometry (Share#1634).
163
+ */
164
+ export declare const LARGE_COORDINATE_BUDGET_M = 10000;
165
+ //# sourceMappingURL=coordination_f64.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordination_f64.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/coordination_f64.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAK9C,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAa,CAAA;AA8CxD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC3B,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAkBxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB,OAAM,CAAA;AAoCtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,EACxC,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,EAC/B,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAgCjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAC/B,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,EACxC,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAerC;AAGD,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,QAAM,CAAA"}
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Float64 coordinate-to-origin (COORDINATE_TO_ORIGIN) math.
3
+ *
4
+ * gl-matrix's `mat4`/`vec4` are backed by `Float32Array`
5
+ * (`ARRAY_TYPE = Float32Array` in gl-matrix/common.js), so the recentre
6
+ * derivation — which subtracts a large world reference point
7
+ * (`transformedPt = placement * nativePoint`, on the order of 1e5 m for a
8
+ * Swiss/CHE georeferenced IFC, up to ~2.6e6 m in LV95 easting/northing) —
9
+ * loses precision: float32 ULP is ~7.6 mm at 100 km and ~60 mm at 2.6 M m.
10
+ * Baked into the emitted FlatMesh transform that quantization forms a
11
+ * spatial grid that reads as rotational jitter when the camera is zoomed
12
+ * to detail.
13
+ *
14
+ * The native placement crosses the wasm boundary as `glm::dmat4` and the
15
+ * reference point as `glm::dvec3` — both full float64 (see
16
+ * conway-api.cpp `getMatrixValues4x4` / the `glmdVec3` value object), so
17
+ * `nativeTransform.getValues()` and `geometry.getPoint()` deliver doubles.
18
+ * Feeding those doubles straight through a double-precision composition
19
+ * (rather than gl-matrix's float32 path, and without the intermediate
20
+ * `mat4.fromValues` truncation to `Float32Array`) fully recovers the
21
+ * precision for georeferenced models.
22
+ *
23
+ * All layout/multiply conventions match gl-matrix exactly (column-major,
24
+ * `out = a * b`), so near-origin models — where float32 and float64 agree
25
+ * to well under a micron — stay bit-comparable across the
26
+ * classic / deferred / preview paths that share this recentre.
27
+ */
28
+ const IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
29
+ /**
30
+ * The Z-up -> Y-up normalize matrix baked into every coordination frame
31
+ * (column-major).
32
+ *
33
+ * Every producer of a coordination frame MUST use the same matrix, or
34
+ * the frames it derives disagree with the durable walk's — which is
35
+ * exactly how the spatial-imposter plates ended up in a different space
36
+ * from the meshes (conway#515).
37
+ *
38
+ * This is the definition for everything that imports it: both preview
39
+ * channels and the spatial-imposter walk. Three identical literals
40
+ * remain, the public `NormalizeMat` field on `IfcAPI`, `IfcApiProxyIfc`
41
+ * and `IfcApiProxyAP214` — the web-ifc shim surface, typed
42
+ * `glmatrix.mat4`. They are the durable frame's producers, so they must
43
+ * stay bit-identical to this; folding them in is worth doing and was
44
+ * left out of conway#516 only to keep that diff to the imposter path.
45
+ */
46
+ export const NORMALIZE_MAT_F64 = [
47
+ 1, 0, 0, 0,
48
+ 0, 0, -1, 0,
49
+ 0, 1, 0, 0,
50
+ 0, 0, 0, 1,
51
+ ];
52
+ /** Identity, for callers that need a "no coordination" frame. */
53
+ export const IDENTITY_MAT4 = IDENTITY;
54
+ /**
55
+ * Smallest positive magnitude representable in single precision
56
+ * (2 ** -149, the smallest float32 subnormal). The previous code path
57
+ * built the placement with gl-matrix `mat4.fromValues(...)` — a
58
+ * `Float32Array` — so any transform component below this magnitude was
59
+ * stored as exactly zero. Valid geometry never produces a non-zero
60
+ * component this small (positions are metres/kilometres, rotation and
61
+ * scale terms are O(1) or exactly zero), so the only inputs it affects
62
+ * are denormal garbage from degenerate/uninitialised native transforms
63
+ * (e.g. a released-then-reopened model whose `getValues()` returns
64
+ * subnormals). Flushing those to zero here keeps the classic, deferred
65
+ * and preview paths bit-identical on such inputs — matching the old
66
+ * Float32Array behaviour — while leaving every valid value at full
67
+ * double precision.
68
+ */
69
+ const FLOAT32_MIN_SUBNORMAL = 2 ** -149;
70
+ /**
71
+ * Flush non-finite and float32-underflow garbage to zero; pass every
72
+ * valid value through untouched at full double precision.
73
+ *
74
+ * @param v A transform component.
75
+ * @return {number} v, or 0 if it is non-finite or below float32 range.
76
+ */
77
+ function flushGarbage(v) {
78
+ return Number.isFinite(v) &&
79
+ (v === 0 || Math.abs(v) >= FLOAT32_MIN_SUBNORMAL) ? v : 0;
80
+ }
81
+ /**
82
+ * Copy 16 matrix components into a fresh `number[]`, flushing float32
83
+ * underflow / non-finite garbage to zero (see FLOAT32_MIN_SUBNORMAL).
84
+ *
85
+ * @param m A 16-element matrix.
86
+ * @return {number[]} The sanitized copy.
87
+ */
88
+ function sanitize16(m) {
89
+ const out = new Array(16);
90
+ for (let i = 0; i < 16; ++i) {
91
+ out[i] = flushGarbage(m[i]);
92
+ }
93
+ return out;
94
+ }
95
+ /**
96
+ * Multiply two column-major 4x4 matrices in float64.
97
+ *
98
+ * Computes `out = a * b`, the identical formula (and operand order) to
99
+ * gl-matrix `mat4.multiply(out, a, b)`, but retaining double precision.
100
+ *
101
+ * @param a Left matrix (16 elements, column-major).
102
+ * @param b Right matrix (16 elements, column-major).
103
+ * @return {number[]} The product as a fresh 16-element `number[]`.
104
+ */
105
+ export function mat4MultiplyF64(a, b) {
106
+ const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];
107
+ const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
108
+ const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
109
+ const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
110
+ const out = new Array(16);
111
+ for (let i = 0; i < 4; ++i) {
112
+ const b0 = b[i * 4], b1 = b[i * 4 + 1], b2 = b[i * 4 + 2], b3 = b[i * 4 + 3];
113
+ out[i * 4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
114
+ out[i * 4 + 1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
115
+ out[i * 4 + 2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
116
+ out[i * 4 + 3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
117
+ }
118
+ return out;
119
+ }
120
+ /**
121
+ * Grid (metres) a recentre snaps to once it is needed at all.
122
+ *
123
+ * The anchor a recentre is derived from is the *first geometry* the walk
124
+ * reaches, which is an arbitrary interior element: whichever one the file
125
+ * happens to declare first. Left as-is, that makes a model's world
126
+ * position a function of its element order, with two consequences users
127
+ * see (conway#87, "not a sound basis for a camera in the permalink"):
128
+ *
129
+ * - Two exports of one object — the same logo as IFC and as STEP, a part
130
+ * re-exported by a different CAD kernel — land in different places,
131
+ * because they disagree about which element comes first. Share#1749
132
+ * hit exactly this: `index.step` sat 76m off `index.ifc` because the
133
+ * IFC declares the x=76 block first and the STEP the x=0 one.
134
+ * - Re-exporting a model with the element order shuffled moves it, so
135
+ * every camera permalink saved against it is silently wrong.
136
+ *
137
+ * `quantizeRecentre` answers that in two stages, because the two ranges
138
+ * want different things:
139
+ *
140
+ * - **Inside LARGE_COORDINATE_BUDGET_M, do not recentre at all.** There
141
+ * is no float32 benefit below the budget — that constant *is* the
142
+ * threshold where quantization becomes visible — so a model within
143
+ * 10km of the origin simply keeps the coordinates its file authored.
144
+ * That is model-zero, conway#87's proposal, and it makes the frame
145
+ * exactly order-independent for the overwhelming majority of models
146
+ * rather than order-independent-per-cell.
147
+ * - **Above it, snap to this grid.** A georeferenced model has to come
148
+ * back near the origin, and snapping keeps that repeatable across
149
+ * exports. Half a cell (500m) out of a 1e4 m budget costs ~0.05mm of
150
+ * float32 resolution, and a whole-kilometre translation is exactly
151
+ * representable where the raw anchor was not, so the recentre itself
152
+ * stops contributing rounding.
153
+ *
154
+ * **Quantizing cannot remove the discontinuity, only move it**, and it
155
+ * is worth being precise about where this one sits, because it is not
156
+ * where you would guess. Snapping *everything* to the grid would put a
157
+ * 1km step at every cell edge, including around the near-origin models
158
+ * that make up almost the whole corpus. Staging moves it to the budget:
159
+ * inside, every anchor derives model-zero and there is no edge at all;
160
+ * the single remaining edge is the budget itself, where the step is
161
+ * `LARGE_COORDINATE_BUDGET_M` (1e4), not the grid (1e3) — an anchor at
162
+ * 9900 derives zero and one at 10100 derives -10000.
163
+ *
164
+ * That edge is also invisible to the adopted-preview-frame gate, which
165
+ * re-derives only when a durable placement lands beyond the budget: a
166
+ * preview anchored at 10100 and a durable first placement at 9900 probe
167
+ * at ~100m, so the preview frame is kept and the model renders 10km off
168
+ * a classic open. The trade is deliberate — one edge that a georeferenced
169
+ * model may sit near, rather than an edge every kilometre through the
170
+ * range where nearly every model lives — but it is a real residual, not
171
+ * an eliminated one. design/new/coordination-frame.md tracks it, and
172
+ * conway#87's relative-to-centre direction is what removes it properly.
173
+ */
174
+ export const COORDINATION_SNAP_M = 1e3;
175
+ /**
176
+ * The recentre for an anchor: all zeros while the anchor is close enough
177
+ * to the origin not to need one, else each component snapped to
178
+ * COORDINATION_SNAP_M.
179
+ *
180
+ * The stage decision is made **once, on the anchor's distance from the
181
+ * origin**, and applied to all three components together. Deciding per
182
+ * component would leave a model offset diagonally — say (9km, 9km, 9km),
183
+ * 15.6km out and well past the budget — with no recentre at all, since
184
+ * no single component crosses the threshold. That silently regresses the
185
+ * float32 jitter fix (Share#1631) the budget exists to enforce.
186
+ *
187
+ * Works in source units: the values are pre-scale, so both the budget
188
+ * and the grid convert by the same `scaleFactor` the caller is about to
189
+ * apply (a millimetre model snaps every 1e6 source units, a metre model
190
+ * every 1e3).
191
+ *
192
+ * @param values The three translation components, in source units.
193
+ * @param scaleFactor The linear scaling factor to metres; already
194
+ * sanitized by the caller.
195
+ * @return {number[]} The recentre per component, in source units.
196
+ */
197
+ function quantizeRecentre(values, scaleFactor) {
198
+ const finite = values.map((v) => (Number.isFinite(v) ? v : 0));
199
+ if (Math.hypot(...finite) * scaleFactor <= LARGE_COORDINATE_BUDGET_M) {
200
+ return [0, 0, 0];
201
+ }
202
+ const gridSourceUnits = COORDINATION_SNAP_M / scaleFactor;
203
+ return finite.map((v) => Math.round(v / gridSourceUnits) * gridSourceUnits);
204
+ }
205
+ /**
206
+ * Derive the coordination (recentre) matrix in float64, matching the
207
+ * gl-matrix op sequence exactly:
208
+ * `scale * NormalizeMat * translate(-quantize(placement * point))`.
209
+ *
210
+ * The quantization is what keeps the derived frame independent of which
211
+ * element a file declares first — see COORDINATION_SNAP_M for why that
212
+ * matters, and why it is staged around LARGE_COORDINATE_BUDGET_M.
213
+ *
214
+ * @param placement The native placement (16 elements, column-major
215
+ * float64 from `getValues()`); `undefined` is treated as identity.
216
+ * @param point The world reference point (`getPoint(0)`), float64.
217
+ * @param normalizeMat The Z-up -> Y-up normalize matrix (16 elements).
218
+ * @param scaleFactor The linear scaling factor.
219
+ * @return {number[]} The coordination matrix as a 16-element `number[]`.
220
+ */
221
+ export function deriveCoordinationF64(placement, point, normalizeMat, scaleFactor) {
222
+ const p = placement !== undefined ? sanitize16(placement) : IDENTITY;
223
+ const { x, y, z } = point;
224
+ // Sanitized once, here, so the promise the rest of this function makes
225
+ // about degenerate input actually holds: a NaN/Infinite factor from a
226
+ // malformed unit-assignment chain would otherwise pass the recentre
227
+ // guard and then poison every component through the scale matrix below.
228
+ const scale1 = Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1;
229
+ // transformedPt = placement * (x, y, z, 1)
230
+ const tx = p[0] * x + p[4] * y + p[8] * z + p[12];
231
+ const ty = p[1] * x + p[5] * y + p[9] * z + p[13];
232
+ const tz = p[2] * x + p[6] * y + p[10] * z + p[14];
233
+ // translate(-quantize(transformedPt))
234
+ const recentre = quantizeRecentre([-tx, -ty, -tz], scale1);
235
+ const translate = IDENTITY.slice();
236
+ translate[12] = recentre[0];
237
+ translate[13] = recentre[1];
238
+ translate[14] = recentre[2];
239
+ // scale(scaleFactor)
240
+ const scale = [
241
+ scale1, 0, 0, 0,
242
+ 0, scale1, 0, 0,
243
+ 0, 0, scale1, 0,
244
+ 0, 0, 0, 1,
245
+ ];
246
+ // scale * (NormalizeMat * translate)
247
+ return mat4MultiplyF64(scale, mat4MultiplyF64(normalizeMat, translate));
248
+ }
249
+ /**
250
+ * Compose the emitted world transform in float64:
251
+ * `coordination * placement [ * translate(geomCenter) ]`.
252
+ *
253
+ * @param coordination The coordination matrix (16 elements).
254
+ * @param placement The native placement (16 elements, column-major
255
+ * float64 from `getValues()`); `undefined` is treated as identity.
256
+ * @param geomCenter The per-leaf normalize centre; omit for the bare
257
+ * composition used by the AP214 shared-buffer path (issue #308).
258
+ * @return {number[]} The flat transform as a 16-element `number[]`,
259
+ * ready to hand back as a FlatMesh `flatTransformation`.
260
+ */
261
+ export function composeTransformF64(coordination, placement, geomCenter) {
262
+ let out = placement !== undefined ?
263
+ mat4MultiplyF64(coordination, sanitize16(placement)) :
264
+ Array.from(coordination);
265
+ if (geomCenter !== undefined) {
266
+ const gm = IDENTITY.slice();
267
+ gm[12] = geomCenter.x;
268
+ gm[13] = geomCenter.y;
269
+ gm[14] = geomCenter.z;
270
+ out = mat4MultiplyF64(out, gm);
271
+ }
272
+ return out;
273
+ }
274
+ // Column-major mat4 translation component indices.
275
+ export const TRANSLATION_X = 12;
276
+ export const TRANSLATION_Y = 13;
277
+ export const TRANSLATION_Z = 14;
278
+ /**
279
+ * Placement-magnitude budget (metres) above which a coordination frame
280
+ * has failed to recentre a model: float32 (the GPU vertex format and
281
+ * BatchedMesh matrix texture) quantizes at ~1mm per 1e4 m of
282
+ * coordinate, the visible-jitter threshold established in Share#1631.
283
+ * Used to validate an adopted preview coordination frame against the
284
+ * durable walk's first geometry (Share#1634).
285
+ */
286
+ export const LARGE_COORDINATE_BUDGET_M = 1e4;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=coordination_f64.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordination_f64.test.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/coordination_f64.test.ts"],"names":[],"mappings":""}