@ifc-lite/renderer 1.15.1 → 1.15.3

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.
@@ -0,0 +1,56 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Euclidean distance between two points.
6
+ */
7
+ export function distance(a, b) {
8
+ const dx = a.x - b.x;
9
+ const dy = a.y - b.y;
10
+ const dz = a.z - b.z;
11
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
12
+ }
13
+ /**
14
+ * Check if two vectors are approximately equal.
15
+ */
16
+ export function vecEquals(a, b, epsilon = 0.0001) {
17
+ return (Math.abs(a.x - b.x) < epsilon &&
18
+ Math.abs(a.y - b.y) < epsilon &&
19
+ Math.abs(a.z - b.z) < epsilon);
20
+ }
21
+ /**
22
+ * Get closest point on an edge segment with parameter t (0-1).
23
+ */
24
+ export function closestPointOnEdgeWithT(point, v0, v1) {
25
+ const dx = v1.x - v0.x;
26
+ const dy = v1.y - v0.y;
27
+ const dz = v1.z - v0.z;
28
+ const lengthSq = dx * dx + dy * dy + dz * dz;
29
+ if (lengthSq < 0.0000001) {
30
+ // Degenerate edge
31
+ return { point: v0, distance: distance(point, v0), t: 0 };
32
+ }
33
+ // Project point onto line
34
+ const t = Math.max(0, Math.min(1, ((point.x - v0.x) * dx + (point.y - v0.y) * dy + (point.z - v0.z) * dz) / lengthSq));
35
+ const closest = {
36
+ x: v0.x + dx * t,
37
+ y: v0.y + dy * t,
38
+ z: v0.z + dz * t,
39
+ };
40
+ return {
41
+ point: closest,
42
+ distance: distance(point, closest),
43
+ t,
44
+ };
45
+ }
46
+ /**
47
+ * Convert screen-space radius to world-space radius.
48
+ */
49
+ export function screenToWorldRadius(screenRadius, dist, fov, screenHeight) {
50
+ // Calculate world height at distance
51
+ const fovRadians = (fov * Math.PI) / 180;
52
+ const worldHeight = 2 * dist * Math.tan(fovRadians / 2);
53
+ // Convert screen pixels to world units
54
+ return (screenRadius / screenHeight) * worldHeight;
55
+ }
56
+ //# sourceMappingURL=snap-geometry-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap-geometry-utils.js","sourceRoot":"","sources":["../src/snap-geometry-utils.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAU/D;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAO,EAAE,CAAO;IACvC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,CAAO,EAAE,CAAO,EAAE,UAAkB,MAAM;IAClE,OAAO,CACL,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO;QAC7B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO;QAC7B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAC9B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAW,EACX,EAAQ,EACR,EAAQ;IAER,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,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AG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACzC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAExD,uCAAuC;IACvC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC,GAAG,WAAW,CAAC;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/renderer",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "WebGPU renderer for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,9 +12,9 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@ifc-lite/geometry": "^1.16.4",
15
+ "@ifc-lite/geometry": "^1.16.5",
16
16
  "@ifc-lite/spatial": "^1.14.5",
17
- "@ifc-lite/wasm": "^1.16.3"
17
+ "@ifc-lite/wasm": "^1.16.4"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@webgpu/types": "^0.1.69",