abstract-3d 2.7.33 → 2.8.1
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.
- package/lib/abstract-3d.d.ts.map +1 -1
- package/lib/abstract-3d.js +45 -28
- package/lib/abstract-3d.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-build.d.ts +4 -0
- package/lib/renderers/dxf/dxf-encoding/dxf-build.d.ts.map +1 -0
- package/lib/renderers/dxf/dxf-encoding/dxf-build.js +8 -0
- package/lib/renderers/dxf/dxf-encoding/dxf-build.js.map +1 -0
- package/lib/renderers/dxf/dxf-encoding/dxf-color.js +1 -0
- package/lib/renderers/dxf/dxf-encoding/dxf-color.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-common.d.ts +1 -3
- package/lib/renderers/dxf/dxf-encoding/dxf-common.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-common.js +0 -12
- package/lib/renderers/dxf/dxf-encoding/dxf-common.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-dimension.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-dimension.js +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-dimension.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-footer.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-footer.js +0 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-footer.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-header.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-header.js +0 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-header.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-line.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-line.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-polyline.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-polyline.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-solid.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-solid.js.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-triangle.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-encoding/dxf-triangle.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-box.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-box.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-box.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-cone.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-cone.js +2 -3
- package/lib/renderers/dxf/dxf-geometries/dxf-cone.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-cylinder.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-cylinder.js +2 -3
- package/lib/renderers/dxf/dxf-geometries/dxf-cylinder.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-dimension.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-dimension.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-dimension.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-image.d.ts +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-image.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-image.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-image.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-plane.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-plane.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-plane.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-polygon.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-polygon.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-polygon.js.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-shape.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-shape.js +1 -1
- package/lib/renderers/dxf/dxf-geometries/dxf-shape.js.map +1 -1
- package/lib/renderers/dxf/dxf.d.ts +1 -1
- package/lib/renderers/dxf/dxf.d.ts.map +1 -1
- package/lib/renderers/dxf/dxf.js +6 -5
- package/lib/renderers/dxf/dxf.js.map +1 -1
- package/lib/renderers/react/react-camera.d.ts +1 -1
- package/lib/renderers/react/react-camera.d.ts.map +1 -1
- package/lib/renderers/react/react-camera.js +12 -17
- package/lib/renderers/react/react-camera.js.map +1 -1
- package/lib/renderers/react/react-dimension.js +1 -1
- package/lib/renderers/react/react-dimension.js.map +1 -1
- package/lib/renderers/react/react-group.d.ts +1 -1
- package/lib/renderers/react/react-group.d.ts.map +1 -1
- package/lib/renderers/react/react-group.js +4 -3
- package/lib/renderers/react/react-group.js.map +1 -1
- package/lib/renderers/react/react-hotspot.d.ts +1 -1
- package/lib/renderers/react/react-hotspot.d.ts.map +1 -1
- package/lib/renderers/react/react-hotspot.js +2 -2
- package/lib/renderers/react/react-hotspot.js.map +1 -1
- package/lib/renderers/react/react-image-material.d.ts.map +1 -1
- package/lib/renderers/react/react-image-material.js +1 -1
- package/lib/renderers/react/react-image-material.js.map +1 -1
- package/lib/renderers/react/react-material.d.ts.map +1 -1
- package/lib/renderers/react/react-material.js +3 -15
- package/lib/renderers/react/react-material.js.map +1 -1
- package/lib/renderers/react/react-mesh.d.ts +1 -1
- package/lib/renderers/react/react-mesh.d.ts.map +1 -1
- package/lib/renderers/react/react-mesh.js +9 -8
- package/lib/renderers/react/react-mesh.js.map +1 -1
- package/lib/renderers/react/react-scene.d.ts +1 -1
- package/lib/renderers/react/react-scene.d.ts.map +1 -1
- package/lib/renderers/react/react-scene.js +3 -11
- package/lib/renderers/react/react-scene.js.map +1 -1
- package/lib/renderers/react/react.d.ts +2 -2
- package/lib/renderers/react/react.d.ts.map +1 -1
- package/lib/renderers/react/react.js +3 -3
- package/lib/renderers/react/react.js.map +1 -1
- package/lib/renderers/step/step-encoding.d.ts.map +1 -1
- package/lib/renderers/step/step-encoding.js.map +1 -1
- package/lib/renderers/step/step-geometries/step-box.d.ts.map +1 -1
- package/lib/renderers/step/step-geometries/step-box.js +1 -1
- package/lib/renderers/step/step-geometries/step-box.js.map +1 -1
- package/lib/renderers/step/step-geometries/step-cylinder.d.ts.map +1 -1
- package/lib/renderers/step/step-geometries/step-cylinder.js.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-cone.d.ts.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-cone.js +1 -2
- package/lib/renderers/stl/stl-geometries/stl-cone.js.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-cylinder.d.ts.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-cylinder.js +1 -2
- package/lib/renderers/stl/stl-geometries/stl-cylinder.js.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-plane.d.ts.map +1 -1
- package/lib/renderers/stl/stl-geometries/stl-plane.js +1 -6
- package/lib/renderers/stl/stl-geometries/stl-plane.js.map +1 -1
- package/lib/renderers/stl/stl.d.ts.map +1 -1
- package/lib/renderers/stl/stl.js +3 -4
- package/lib/renderers/stl/stl.js.map +1 -1
- package/lib/renderers/svg/svg-encoding.d.ts.map +1 -1
- package/lib/renderers/svg/svg-encoding.js +3 -3
- package/lib/renderers/svg/svg-encoding.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/shared.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/shared.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-box.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-box.js +2 -2
- package/lib/renderers/svg/svg-geometries/svg-box.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-cone.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-cone.js +3 -8
- package/lib/renderers/svg/svg-geometries/svg-cone.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-cylinder.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-cylinder.js +3 -8
- package/lib/renderers/svg/svg-geometries/svg-cylinder.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-image.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-image.js +2 -2
- package/lib/renderers/svg/svg-geometries/svg-image.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-line.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-line.js +3 -5
- package/lib/renderers/svg/svg-geometries/svg-line.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-plane.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-plane.js +3 -5
- package/lib/renderers/svg/svg-geometries/svg-plane.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-polygon.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-polygon.js +3 -5
- package/lib/renderers/svg/svg-geometries/svg-polygon.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-shape.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-shape.js +2 -2
- package/lib/renderers/svg/svg-geometries/svg-shape.js.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-text.d.ts.map +1 -1
- package/lib/renderers/svg/svg-geometries/svg-text.js +1 -1
- package/lib/renderers/svg/svg-geometries/svg-text.js.map +1 -1
- package/lib/renderers/svg/svg.d.ts +1 -1
- package/lib/renderers/svg/svg.d.ts.map +1 -1
- package/lib/renderers/svg/svg.js +5 -5
- package/lib/renderers/svg/svg.js.map +1 -1
- package/lib/utils.d.ts +3 -5
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +12 -20
- package/lib/utils.js.map +1 -1
- package/package.json +17 -17
- package/src/abstract-3d.ts +68 -149
- package/src/custom_typings/react-three-fiber.d.ts +1 -1
- package/src/renderers/dxf/dxf-encoding/dxf-build.ts +10 -0
- package/src/renderers/dxf/dxf-encoding/dxf-color.ts +1 -0
- package/src/renderers/dxf/dxf-encoding/dxf-common.ts +1 -23
- package/src/renderers/dxf/dxf-encoding/dxf-dimension.ts +3 -26
- package/src/renderers/dxf/dxf-encoding/dxf-footer.ts +0 -1
- package/src/renderers/dxf/dxf-encoding/dxf-header.ts +0 -1
- package/src/renderers/dxf/dxf-encoding/dxf-line.ts +1 -7
- package/src/renderers/dxf/dxf-encoding/dxf-polyline.ts +1 -7
- package/src/renderers/dxf/dxf-encoding/dxf-solid.ts +1 -9
- package/src/renderers/dxf/dxf-encoding/dxf-triangle.ts +4 -16
- package/src/renderers/dxf/dxf-geometries/dxf-box.ts +2 -11
- package/src/renderers/dxf/dxf-geometries/dxf-cone.ts +3 -19
- package/src/renderers/dxf/dxf-geometries/dxf-cylinder.ts +4 -22
- package/src/renderers/dxf/dxf-geometries/dxf-dimension.ts +1 -8
- package/src/renderers/dxf/dxf-geometries/dxf-image.ts +3 -13
- package/src/renderers/dxf/dxf-geometries/dxf-plane.ts +3 -19
- package/src/renderers/dxf/dxf-geometries/dxf-polygon.ts +2 -9
- package/src/renderers/dxf/dxf-geometries/dxf-shape.ts +2 -10
- package/src/renderers/dxf/dxf.ts +10 -25
- package/src/renderers/react/react-camera.tsx +26 -25
- package/src/renderers/react/react-dimension.tsx +1 -7
- package/src/renderers/react/react-group.tsx +6 -16
- package/src/renderers/react/react-hotspot.tsx +4 -10
- package/src/renderers/react/react-image-material.tsx +1 -1
- package/src/renderers/react/react-material.tsx +4 -21
- package/src/renderers/react/react-mesh.tsx +14 -68
- package/src/renderers/react/react-scene.tsx +7 -21
- package/src/renderers/react/react.tsx +3 -3
- package/src/renderers/step/step-encoding.ts +36 -100
- package/src/renderers/step/step-geometries/step-box.ts +2 -17
- package/src/renderers/step/step-geometries/step-cylinder.ts +6 -36
- package/src/renderers/stl/stl-geometries/stl-cone.ts +1 -2
- package/src/renderers/stl/stl-geometries/stl-cylinder.ts +1 -2
- package/src/renderers/stl/stl-geometries/stl-plane.ts +1 -6
- package/src/renderers/stl/stl.ts +3 -7
- package/src/renderers/svg/svg-encoding.ts +12 -44
- package/src/renderers/svg/svg-geometries/shared.ts +1 -4
- package/src/renderers/svg/svg-geometries/svg-box.ts +2 -2
- package/src/renderers/svg/svg-geometries/svg-cone.ts +5 -14
- package/src/renderers/svg/svg-geometries/svg-cylinder.ts +5 -17
- package/src/renderers/svg/svg-geometries/svg-image.ts +5 -15
- package/src/renderers/svg/svg-geometries/svg-line.ts +3 -8
- package/src/renderers/svg/svg-geometries/svg-plane.ts +3 -8
- package/src/renderers/svg/svg-geometries/svg-polygon.ts +3 -8
- package/src/renderers/svg/svg-geometries/svg-shape.ts +2 -2
- package/src/renderers/svg/svg-geometries/svg-text.ts +1 -1
- package/src/renderers/svg/svg.ts +8 -18
- package/src/utils.ts +13 -18
- package/CHANGELOG.md +0 -92
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3D,QAAQ;AACR,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAA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,OAAO,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abstract-3d",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
|
+
"gitHead": "969779b1e37399d16a5cdc8af10dbd99b1bc18c0",
|
|
4
5
|
"description": "Abstract 3D",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"author": "Divid AB <info@divid.se>",
|
|
6
8
|
"repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-3d",
|
|
7
|
-
"
|
|
9
|
+
"files": [
|
|
10
|
+
"/lib",
|
|
11
|
+
"/src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"package.json"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
8
17
|
"main": "lib/index.js",
|
|
9
18
|
"types": "lib/index",
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"type": "module",
|
|
12
19
|
"exports": {
|
|
13
20
|
".": {
|
|
14
21
|
"ts": "./src/index.ts",
|
|
@@ -41,29 +48,22 @@
|
|
|
41
48
|
"import": "./lib/renderers/svg/index.js"
|
|
42
49
|
}
|
|
43
50
|
},
|
|
44
|
-
"files": [
|
|
45
|
-
"/lib",
|
|
46
|
-
"/src",
|
|
47
|
-
"README.md",
|
|
48
|
-
"package.json"
|
|
49
|
-
],
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@react-three/drei": "^10.7.7",
|
|
52
53
|
"@react-three/fiber": "^9.6.1",
|
|
53
54
|
"@react-three/postprocessing": "^3.0.4",
|
|
54
|
-
"abstract-image": "^13.
|
|
55
|
+
"abstract-image": "^13.1.1",
|
|
55
56
|
"suspend-react": "^0.1.3",
|
|
56
57
|
"three": "^0.184.0",
|
|
57
58
|
"ts-exhaustive-check": "^1.0.0"
|
|
58
59
|
},
|
|
59
|
-
"peerDependencies": {
|
|
60
|
-
"react": "^19.2.0"
|
|
61
|
-
},
|
|
62
60
|
"devDependencies": {
|
|
63
|
-
"@types/react": "
|
|
61
|
+
"@types/react": "catalog:",
|
|
64
62
|
"@types/react-reconciler": "^0.33.0",
|
|
65
63
|
"@types/three": "^0.180.0",
|
|
66
|
-
"react": "
|
|
64
|
+
"react": "catalog:"
|
|
67
65
|
},
|
|
68
|
-
"
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": "catalog:"
|
|
68
|
+
}
|
|
69
69
|
}
|
package/src/abstract-3d.ts
CHANGED
|
@@ -79,19 +79,7 @@ export type Group = {
|
|
|
79
79
|
|
|
80
80
|
export type Mesh = {
|
|
81
81
|
readonly material: Material;
|
|
82
|
-
readonly geometry:
|
|
83
|
-
| Cylinder
|
|
84
|
-
| Cone
|
|
85
|
-
| Box
|
|
86
|
-
| Line
|
|
87
|
-
| CulledLine
|
|
88
|
-
| Text
|
|
89
|
-
| Polygon
|
|
90
|
-
| Plane
|
|
91
|
-
| Tube
|
|
92
|
-
| Sphere
|
|
93
|
-
| Shape
|
|
94
|
-
| ImageMesh;
|
|
82
|
+
readonly geometry: Cylinder | Cone | Box | Line | CulledLine | Text | Polygon | Plane | Tube | Sphere | Shape | ImageMesh;
|
|
95
83
|
};
|
|
96
84
|
|
|
97
85
|
export type Material = {
|
|
@@ -324,7 +312,7 @@ export const vec3Normalize = (v: Vec3): Vec3 => vec3Scale(v, 1 / vec3Length(v));
|
|
|
324
312
|
|
|
325
313
|
export const vec2Greater = (a: Vec2, b: Vec2): Vec2 => vec2(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y);
|
|
326
314
|
|
|
327
|
-
export const vec2DistSquared = (a: Vec2, b: Vec2): number =>
|
|
315
|
+
export const vec2DistSquared = (a: Vec2, b: Vec2): number => (b.x - a.x) ** 2 + (b.y - a.y) ** 2;
|
|
328
316
|
|
|
329
317
|
export const vec2Dist = (a: Vec2, b: Vec2): number => vec2DistSquared(a, b);
|
|
330
318
|
|
|
@@ -341,11 +329,9 @@ export const vec3XMean = (...v: ReadonlyArray<Vec3>): number => v.reduce((a, c)
|
|
|
341
329
|
export const vec3YMean = (...v: ReadonlyArray<Vec3>): number => v.reduce((a, c) => a + c.y, 0) / v.length;
|
|
342
330
|
export const vec3ZMean = (...v: ReadonlyArray<Vec3>): number => v.reduce((a, c) => a + c.z, 0) / v.length;
|
|
343
331
|
|
|
344
|
-
export const vec3Greater = (a: Vec3, b: Vec3): Vec3 =>
|
|
345
|
-
vec3(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z);
|
|
332
|
+
export const vec3Greater = (a: Vec3, b: Vec3): Vec3 => vec3(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z);
|
|
346
333
|
|
|
347
|
-
export const vec3DistSquared = (a: Vec3, b: Vec3): number =>
|
|
348
|
-
Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2) + Math.pow(b.z - a.z, 2);
|
|
334
|
+
export const vec3DistSquared = (a: Vec3, b: Vec3): number => (b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2;
|
|
349
335
|
|
|
350
336
|
export const vec3Dist = (a: Vec3, b: Vec3): number => vec3DistSquared(a, b);
|
|
351
337
|
|
|
@@ -354,8 +340,7 @@ export const vec3Cross = (left: Vec3, right: Vec3): Vec3 =>
|
|
|
354
340
|
|
|
355
341
|
const TOLERANCE = 0.001;
|
|
356
342
|
|
|
357
|
-
export const equals = (num1: number, num2: number, tolerance = TOLERANCE): boolean =>
|
|
358
|
-
Math.abs(num1 - num2) <= tolerance;
|
|
343
|
+
export const equals = (num1: number, num2: number, tolerance = TOLERANCE): boolean => Math.abs(num1 - num2) <= tolerance;
|
|
359
344
|
export const isZero = (num: number, tolerance = TOLERANCE): boolean => Math.abs(num) <= tolerance;
|
|
360
345
|
export const geq = (num1: number, num2: number, tolerance = TOLERANCE): boolean => num1 >= num2 - tolerance;
|
|
361
346
|
export const greater = (num1: number, num2: number, tolerance = TOLERANCE): boolean => num1 > num2 + tolerance;
|
|
@@ -374,11 +359,9 @@ export const bounds3Zero: Bounds3 = bounds3(vec3Zero, vec3Zero);
|
|
|
374
359
|
|
|
375
360
|
export const bounds2ToSize = (bounds: Bounds2): Vec2 => vec2(bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y);
|
|
376
361
|
|
|
377
|
-
export const bounds2Shift = (bounds: Bounds2, offset: Vec2): Bounds2 =>
|
|
378
|
-
bounds2(vec2Add(bounds.min, offset), vec2Add(bounds.max, offset));
|
|
362
|
+
export const bounds2Shift = (bounds: Bounds2, offset: Vec2): Bounds2 => bounds2(vec2Add(bounds.min, offset), vec2Add(bounds.max, offset));
|
|
379
363
|
|
|
380
|
-
export const bounds3ToSize = (bounds: Bounds3): Vec3 =>
|
|
381
|
-
vec3(bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y, bounds.max.z - bounds.min.z);
|
|
364
|
+
export const bounds3ToSize = (bounds: Bounds3): Vec3 => vec3(bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y, bounds.max.z - bounds.min.z);
|
|
382
365
|
|
|
383
366
|
export const bounds3Overlap = (a: Bounds3, b: Bounds3, tolerance = TOLERANCE): boolean =>
|
|
384
367
|
!(
|
|
@@ -390,12 +373,10 @@ export const bounds3Overlap = (a: Bounds3, b: Bounds3, tolerance = TOLERANCE): b
|
|
|
390
373
|
geq(a.min.z, b.max.z, tolerance)
|
|
391
374
|
);
|
|
392
375
|
|
|
393
|
-
export const boundsContains = (a: Bounds, b: Bounds, tolerance = TOLERANCE): boolean =>
|
|
394
|
-
leq(a.min, b.min, tolerance) && geq(a.max, b.max, tolerance);
|
|
376
|
+
export const boundsContains = (a: Bounds, b: Bounds, tolerance = TOLERANCE): boolean => leq(a.min, b.min, tolerance) && geq(a.max, b.max, tolerance);
|
|
395
377
|
|
|
396
378
|
export const boundsOverlap = (a: Bounds, b: Bounds, tolerance = TOLERANCE): boolean =>
|
|
397
|
-
(greater(a.max, b.min, tolerance) && less(a.min, b.max, tolerance)) ||
|
|
398
|
-
(greater(b.max, a.min, tolerance) && less(b.min, a.max, tolerance));
|
|
379
|
+
(greater(a.max, b.min, tolerance) && less(a.min, b.max, tolerance)) || (greater(b.max, a.min, tolerance) && less(b.min, a.max, tolerance));
|
|
399
380
|
|
|
400
381
|
export const bounds2OverlapY = (a: Bounds2, b: Bounds2, tolerance = TOLERANCE): boolean =>
|
|
401
382
|
(greater(a.max.y, b.min.y, tolerance) && less(a.min.y, b.max.y, tolerance)) ||
|
|
@@ -406,13 +387,9 @@ export const boundsXOverlapX = (a: Bounds2, b: Bounds2, tolerance = TOLERANCE):
|
|
|
406
387
|
(greater(b.max.x, a.min.x, tolerance) && less(b.min.x, a.max.x, tolerance));
|
|
407
388
|
|
|
408
389
|
export const bounds2Contains = (a: Bounds2, b: Bounds2, tolerance = TOLERANCE): boolean =>
|
|
409
|
-
leq(a.min.x, b.min.x, tolerance) &&
|
|
410
|
-
geq(a.max.x, b.max.x, tolerance) &&
|
|
411
|
-
leq(a.min.y, b.min.y, tolerance) &&
|
|
412
|
-
geq(a.max.y, b.max.y, tolerance);
|
|
390
|
+
leq(a.min.x, b.min.x, tolerance) && geq(a.max.x, b.max.x, tolerance) && leq(a.min.y, b.min.y, tolerance) && geq(a.max.y, b.max.y, tolerance);
|
|
413
391
|
|
|
414
|
-
export const bounds2Center = (bounds: Bounds2): Vec2 =>
|
|
415
|
-
vec2((bounds.min.x + bounds.max.x) / 2, (bounds.min.y + bounds.max.y) / 2);
|
|
392
|
+
export const bounds2Center = (bounds: Bounds2): Vec2 => vec2((bounds.min.x + bounds.max.x) / 2, (bounds.min.y + bounds.max.y) / 2);
|
|
416
393
|
|
|
417
394
|
export const bounds3Center = (bounds: Bounds3): Vec3 =>
|
|
418
395
|
vec3((bounds.min.x + bounds.max.x) / 2, (bounds.min.y + bounds.max.y) / 2, (bounds.min.z + bounds.max.z) / 2);
|
|
@@ -672,24 +649,28 @@ export function boundsText(t: Text, parentPos: Vec3, parentRot: Vec3): Bounds3 {
|
|
|
672
649
|
// -- Transformations
|
|
673
650
|
|
|
674
651
|
export function vec3RotCombine(outer: Vec3, inner: Vec3): Vec3 {
|
|
675
|
-
if (inner.x === 0 && inner.y === 0 && inner.z === 0)
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
|
|
652
|
+
if (inner.x === 0 && inner.y === 0 && inner.z === 0) {
|
|
653
|
+
return outer;
|
|
654
|
+
}
|
|
655
|
+
if (outer.x === 0 && outer.y === 0 && outer.z === 0) {
|
|
656
|
+
return inner;
|
|
657
|
+
}
|
|
658
|
+
const oc1 = Math.cos(outer.x / 2);
|
|
659
|
+
const os1 = Math.sin(outer.x / 2);
|
|
660
|
+
const oc2 = Math.cos(outer.y / 2);
|
|
661
|
+
const os2 = Math.sin(outer.y / 2);
|
|
662
|
+
const oc3 = Math.cos(outer.z / 2);
|
|
663
|
+
const os3 = Math.sin(outer.z / 2);
|
|
683
664
|
const ax = os1 * oc2 * oc3 + oc1 * os2 * os3;
|
|
684
665
|
const ay = oc1 * os2 * oc3 - os1 * oc2 * os3;
|
|
685
666
|
const az = oc1 * oc2 * os3 + os1 * os2 * oc3;
|
|
686
667
|
const aw = oc1 * oc2 * oc3 - os1 * os2 * os3;
|
|
687
|
-
const ic1 = Math.cos(inner.x / 2)
|
|
688
|
-
|
|
689
|
-
const ic2 = Math.cos(inner.y / 2)
|
|
690
|
-
|
|
691
|
-
const ic3 = Math.cos(inner.z / 2)
|
|
692
|
-
|
|
668
|
+
const ic1 = Math.cos(inner.x / 2);
|
|
669
|
+
const is1 = Math.sin(inner.x / 2);
|
|
670
|
+
const ic2 = Math.cos(inner.y / 2);
|
|
671
|
+
const is2 = Math.sin(inner.y / 2);
|
|
672
|
+
const ic3 = Math.cos(inner.z / 2);
|
|
673
|
+
const is3 = Math.sin(inner.z / 2);
|
|
693
674
|
const bx = is1 * ic2 * ic3 + ic1 * is2 * is3;
|
|
694
675
|
const by = ic1 * is2 * ic3 - is1 * ic2 * is3;
|
|
695
676
|
const bz = ic1 * ic2 * is3 + is1 * is2 * ic3;
|
|
@@ -713,12 +694,12 @@ export function vec3RotCombine(outer: Vec3, inner: Vec3): Vec3 {
|
|
|
713
694
|
}
|
|
714
695
|
|
|
715
696
|
export function vec3RotInverse(rotation: Vec3): Vec3 {
|
|
716
|
-
const c1 = Math.cos(rotation.x / 2)
|
|
717
|
-
|
|
718
|
-
const c2 = Math.cos(rotation.y / 2)
|
|
719
|
-
|
|
720
|
-
const c3 = Math.cos(rotation.z / 2)
|
|
721
|
-
|
|
697
|
+
const c1 = Math.cos(rotation.x / 2);
|
|
698
|
+
const s1 = Math.sin(rotation.x / 2);
|
|
699
|
+
const c2 = Math.cos(rotation.y / 2);
|
|
700
|
+
const s2 = Math.sin(rotation.y / 2);
|
|
701
|
+
const c3 = Math.cos(rotation.z / 2);
|
|
702
|
+
const s3 = Math.sin(rotation.z / 2);
|
|
722
703
|
|
|
723
704
|
// Euler -> Quaternion
|
|
724
705
|
const qx = -(s1 * c2 * c3 + c1 * s2 * s3);
|
|
@@ -745,38 +726,38 @@ export function vec3RotInverse(rotation: Vec3): Vec3 {
|
|
|
745
726
|
}
|
|
746
727
|
|
|
747
728
|
export function vec3Rot(point: Vec3, origin: Vec3, rotation: Vec3): Vec3 {
|
|
748
|
-
if (rotation.x === 0 && rotation.y === 0 && rotation.z === 0)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
const
|
|
754
|
-
|
|
729
|
+
if (rotation.x === 0 && rotation.y === 0 && rotation.z === 0) {
|
|
730
|
+
return point;
|
|
731
|
+
}
|
|
732
|
+
const c1 = Math.cos(rotation.x / 2);
|
|
733
|
+
const s1 = Math.sin(rotation.x / 2);
|
|
734
|
+
const c2 = Math.cos(rotation.y / 2);
|
|
735
|
+
const s2 = Math.sin(rotation.y / 2);
|
|
736
|
+
const c3 = Math.cos(rotation.z / 2);
|
|
737
|
+
const s3 = Math.sin(rotation.z / 2);
|
|
755
738
|
const qx = s1 * c2 * c3 + c1 * s2 * s3;
|
|
756
739
|
const qy = c1 * s2 * c3 - s1 * c2 * s3;
|
|
757
740
|
const qz = c1 * c2 * s3 + s1 * s2 * c3;
|
|
758
741
|
const qw = c1 * c2 * c3 - s1 * s2 * s3;
|
|
759
|
-
const vx = point.x - origin.x
|
|
760
|
-
|
|
761
|
-
|
|
742
|
+
const vx = point.x - origin.x;
|
|
743
|
+
const vy = point.y - origin.y;
|
|
744
|
+
const vz = point.z - origin.z;
|
|
762
745
|
const tx = 2 * (qy * vz - qz * vy);
|
|
763
746
|
const ty = 2 * (qz * vx - qx * vz);
|
|
764
747
|
const tz = 2 * (qx * vy - qy * vx);
|
|
765
|
-
return vec3(
|
|
766
|
-
vx + qw * tx + qy * tz - qz * ty + origin.x,
|
|
767
|
-
vy + qw * ty + qz * tx - qx * tz + origin.y,
|
|
768
|
-
vz + qw * tz + qx * ty - qy * tx + origin.z
|
|
769
|
-
);
|
|
748
|
+
return vec3(vx + qw * tx + qy * tz - qz * ty + origin.x, vy + qw * ty + qz * tx - qx * tz + origin.y, vz + qw * tz + qx * ty - qy * tx + origin.z);
|
|
770
749
|
}
|
|
771
750
|
|
|
772
751
|
export const vec3TransRot = (p: Vec3, pos: Vec3, rot: Vec3): Vec3 => {
|
|
773
|
-
if (rot.x === 0 && rot.y === 0 && rot.z === 0)
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
|
|
752
|
+
if (rot.x === 0 && rot.y === 0 && rot.z === 0) {
|
|
753
|
+
return vec3(p.x + pos.x, p.y + pos.y, p.z + pos.z);
|
|
754
|
+
}
|
|
755
|
+
const c1 = Math.cos(rot.x / 2);
|
|
756
|
+
const s1 = Math.sin(rot.x / 2);
|
|
757
|
+
const c2 = Math.cos(rot.y / 2);
|
|
758
|
+
const s2 = Math.sin(rot.y / 2);
|
|
759
|
+
const c3 = Math.cos(rot.z / 2);
|
|
760
|
+
const s3 = Math.sin(rot.z / 2);
|
|
780
761
|
const qx = s1 * c2 * c3 + c1 * s2 * s3;
|
|
781
762
|
const qy = c1 * s2 * c3 - s1 * c2 * s3;
|
|
782
763
|
const qz = c1 * c2 * s3 + s1 * s2 * c3;
|
|
@@ -784,11 +765,7 @@ export const vec3TransRot = (p: Vec3, pos: Vec3, rot: Vec3): Vec3 => {
|
|
|
784
765
|
const tx = 2 * (qy * p.z - qz * p.y);
|
|
785
766
|
const ty = 2 * (qz * p.x - qx * p.z);
|
|
786
767
|
const tz = 2 * (qx * p.y - qy * p.x);
|
|
787
|
-
return vec3(
|
|
788
|
-
p.x + qw * tx + qy * tz - qz * ty + pos.x,
|
|
789
|
-
p.y + qw * ty + qz * tx - qx * tz + pos.y,
|
|
790
|
-
p.z + qw * tz + qx * ty - qy * tx + pos.z
|
|
791
|
-
);
|
|
768
|
+
return vec3(p.x + qw * tx + qy * tz - qz * ty + pos.x, p.y + qw * ty + qz * tx - qx * tz + pos.y, p.z + qw * tz + qx * ty - qy * tx + pos.z);
|
|
792
769
|
};
|
|
793
770
|
|
|
794
771
|
export function vec3BasisToEuler(direction: Vec3, normal: Vec3): Vec3 {
|
|
@@ -826,11 +803,7 @@ export function geoRot<T extends Box | Plane | Cone | Cylinder | Text | Group>(g
|
|
|
826
803
|
export function geoTrans<T extends Box | Plane | Cone | Cylinder | Text | Group>(g: T, translate: Vec3): T {
|
|
827
804
|
return { ...g, pos: vec3Add(g.pos, translate) };
|
|
828
805
|
}
|
|
829
|
-
export function geoTransRot<T extends Box | Plane | Cone | Cylinder | Text | Group | Tube>(
|
|
830
|
-
g: T,
|
|
831
|
-
origin: Vec3,
|
|
832
|
-
rot: Vec3
|
|
833
|
-
): T {
|
|
806
|
+
export function geoTransRot<T extends Box | Plane | Cone | Cylinder | Text | Group | Tube>(g: T, origin: Vec3, rot: Vec3): T {
|
|
834
807
|
return { ...g, pos: vec3Rot(vec3Add(g.pos, origin), origin, rot), rot: vec3RotCombine(rot, g.rot ?? vec3Zero) };
|
|
835
808
|
}
|
|
836
809
|
|
|
@@ -879,35 +852,18 @@ export const group = (
|
|
|
879
852
|
): Group => ({ meshes, pos, rot, data, groups, animation: animation! });
|
|
880
853
|
|
|
881
854
|
export const boxMesh = (box: Box, material: Material): Mesh => ({ geometry: box, material });
|
|
882
|
-
export const boxGeometry = (
|
|
883
|
-
size: Vec3,
|
|
884
|
-
pos: Vec3 = vec3Zero,
|
|
885
|
-
rot = vec3Zero,
|
|
886
|
-
holes: ReadonlyArray<Hole> = []
|
|
887
|
-
): Box => ({
|
|
855
|
+
export const boxGeometry = (size: Vec3, pos: Vec3 = vec3Zero, rot = vec3Zero, holes: ReadonlyArray<Hole> = []): Box => ({
|
|
888
856
|
type: "Box",
|
|
889
857
|
pos,
|
|
890
858
|
rot,
|
|
891
859
|
size,
|
|
892
860
|
holes,
|
|
893
861
|
});
|
|
894
|
-
export const box = (
|
|
895
|
-
size: Vec3,
|
|
896
|
-
material: Material,
|
|
897
|
-
pos: Vec3 = vec3Zero,
|
|
898
|
-
rot = vec3Zero,
|
|
899
|
-
holes: ReadonlyArray<Hole> = []
|
|
900
|
-
): BoxMesh => ({
|
|
862
|
+
export const box = (size: Vec3, material: Material, pos: Vec3 = vec3Zero, rot = vec3Zero, holes: ReadonlyArray<Hole> = []): BoxMesh => ({
|
|
901
863
|
geometry: { type: "Box", pos, rot, size, holes },
|
|
902
864
|
material,
|
|
903
865
|
});
|
|
904
|
-
export const image = (
|
|
905
|
-
size: Vec3,
|
|
906
|
-
material: Material,
|
|
907
|
-
image: ImageMesh["image"],
|
|
908
|
-
pos: Vec3 = vec3Zero,
|
|
909
|
-
rot: Vec3 = vec3Zero
|
|
910
|
-
): Mesh => ({
|
|
866
|
+
export const image = (size: Vec3, material: Material, image: ImageMesh["image"], pos: Vec3 = vec3Zero, rot: Vec3 = vec3Zero): Mesh => ({
|
|
911
867
|
material,
|
|
912
868
|
geometry: {
|
|
913
869
|
type: "Image",
|
|
@@ -921,13 +877,7 @@ export const image = (
|
|
|
921
877
|
export const roundHole = (pos: Vec2, radius: number): Hole => ({ type: "RoundHole", pos, radius });
|
|
922
878
|
export const squareHole = (pos: Vec2, size: Vec2): Hole => ({ type: "SquareHole", pos, size });
|
|
923
879
|
|
|
924
|
-
export const plane = (
|
|
925
|
-
pos: Vec3,
|
|
926
|
-
size: Vec2,
|
|
927
|
-
material: Material,
|
|
928
|
-
rot = vec3Zero,
|
|
929
|
-
holes: ReadonlyArray<Hole> = []
|
|
930
|
-
): PlaneMesh => ({
|
|
880
|
+
export const plane = (pos: Vec3, size: Vec2, material: Material, rot = vec3Zero, holes: ReadonlyArray<Hole> = []): PlaneMesh => ({
|
|
931
881
|
geometry: { type: "Plane", pos, rot, size, holes },
|
|
932
882
|
material,
|
|
933
883
|
});
|
|
@@ -976,12 +926,7 @@ export const shape = (
|
|
|
976
926
|
holes: ReadonlyArray<Hole> = []
|
|
977
927
|
): ShapeMesh => ({ geometry: { type: "Shape", points, pos, rot, thickness, holes }, material });
|
|
978
928
|
|
|
979
|
-
export const polygon = (
|
|
980
|
-
points: ReadonlyArray<Vec3>,
|
|
981
|
-
material: Material,
|
|
982
|
-
pos = vec3Zero,
|
|
983
|
-
rot = vec3Zero
|
|
984
|
-
): PolygonMesh => ({
|
|
929
|
+
export const polygon = (points: ReadonlyArray<Vec3>, material: Material, pos = vec3Zero, rot = vec3Zero): PolygonMesh => ({
|
|
985
930
|
geometry: { type: "Polygon", points, pos, rot },
|
|
986
931
|
material,
|
|
987
932
|
});
|
|
@@ -1004,13 +949,7 @@ export const culledLineGeo = (start: Vec3, end: Vec3, normal: Vec3, thickness: n
|
|
|
1004
949
|
normal,
|
|
1005
950
|
thickness,
|
|
1006
951
|
});
|
|
1007
|
-
export const culledLine = (
|
|
1008
|
-
start: Vec3,
|
|
1009
|
-
end: Vec3,
|
|
1010
|
-
normal: Vec3,
|
|
1011
|
-
thickness: number,
|
|
1012
|
-
material: Material
|
|
1013
|
-
): CulledLineMesh => ({
|
|
952
|
+
export const culledLine = (start: Vec3, end: Vec3, normal: Vec3, thickness: number, material: Material): CulledLineMesh => ({
|
|
1014
953
|
geometry: { type: "CulledLine", start, end, normal, thickness },
|
|
1015
954
|
material,
|
|
1016
955
|
});
|
|
@@ -1062,15 +1001,7 @@ export function dimensionMeshifyAlignedDimension(
|
|
|
1062
1001
|
sceneRotation: Vec3,
|
|
1063
1002
|
_viewRotation: Vec3,
|
|
1064
1003
|
onCreateLine: (start: Vec3, end: Vec3, norm: Vec3, thickness: number, mat: Material) => void,
|
|
1065
|
-
onCreateText: (
|
|
1066
|
-
pos: Vec3,
|
|
1067
|
-
measurement: string,
|
|
1068
|
-
fontSize: number,
|
|
1069
|
-
mat: Material,
|
|
1070
|
-
rot: Vec3,
|
|
1071
|
-
dir: Vec3,
|
|
1072
|
-
normal: Vec3
|
|
1073
|
-
) => void,
|
|
1004
|
+
onCreateText: (pos: Vec3, measurement: string, fontSize: number, mat: Material, rot: Vec3, dir: Vec3, normal: Vec3) => void,
|
|
1074
1005
|
onCreatePolygon: (p1: Vec3, p2: Vec3, p3: Vec3, mat: Material) => void,
|
|
1075
1006
|
dimensionsMaterial?: Material
|
|
1076
1007
|
): void {
|
|
@@ -1164,11 +1095,7 @@ export function dimensionMeshifyAlignedDimension(
|
|
|
1164
1095
|
}
|
|
1165
1096
|
}
|
|
1166
1097
|
|
|
1167
|
-
export function dimensionConvertToTypeMesh(
|
|
1168
|
-
dimension: Dimension,
|
|
1169
|
-
sceneRotation: Vec3,
|
|
1170
|
-
dimensionsMaterial?: Material
|
|
1171
|
-
): DimensionMesh {
|
|
1098
|
+
export function dimensionConvertToTypeMesh(dimension: Dimension, sceneRotation: Vec3, dimensionsMaterial?: Material): DimensionMesh {
|
|
1172
1099
|
if (dimensionIsOfTypeMesh(dimension)) {
|
|
1173
1100
|
return dimension;
|
|
1174
1101
|
}
|
|
@@ -1183,15 +1110,7 @@ export function dimensionConvertToTypeMesh(
|
|
|
1183
1110
|
const onCreatePolygon = (p1: Vec3, p2: Vec3, p3: Vec3, mat: Material): void => {
|
|
1184
1111
|
meshes.push(polygon([p1, p2, p3], mat));
|
|
1185
1112
|
};
|
|
1186
|
-
dimensionMeshifyAlignedDimension(
|
|
1187
|
-
dimension,
|
|
1188
|
-
sceneRotation,
|
|
1189
|
-
vec3Zero,
|
|
1190
|
-
onCreateLine,
|
|
1191
|
-
onCreateText,
|
|
1192
|
-
onCreatePolygon,
|
|
1193
|
-
dimensionsMaterial
|
|
1194
|
-
);
|
|
1113
|
+
dimensionMeshifyAlignedDimension(dimension, sceneRotation, vec3Zero, onCreateLine, onCreateText, onCreatePolygon, dimensionsMaterial);
|
|
1195
1114
|
|
|
1196
1115
|
return {
|
|
1197
1116
|
meshes,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { generateUUID } from "three/src/math/MathUtils.js";
|
|
2
|
+
import type { Bounds3, Vec3 } from "../../../abstract-3d.js";
|
|
3
|
+
import type { DxfDimensionDefinition } from "./dxf-dimension.js";
|
|
4
|
+
import { dxfEncFooter } from "./dxf-footer.js";
|
|
5
|
+
import { dxfEncHeader } from "./dxf-header.js";
|
|
6
|
+
|
|
7
|
+
export function dxfBuild(groups: string, dimensions: DxfDimensionDefinition, bounds: Bounds3, size: Vec3, center: Vec3): string {
|
|
8
|
+
const id = generateUUID();
|
|
9
|
+
return dxfEncHeader(bounds, center, id, size, dimensions.block, dimensions.blockRecord) + groups + dimensions.entity + dxfEncFooter(id);
|
|
10
|
+
}
|
|
@@ -58,6 +58,7 @@ function colorNormalToVec3Color(colorNormal: string): Vec3 {
|
|
|
58
58
|
function dxfBitShiftColor(color: string): number {
|
|
59
59
|
const originalColor = colorNormalToVec3Color(color);
|
|
60
60
|
|
|
61
|
+
// oxlint-disable-next-line no-bitwise
|
|
61
62
|
const colorAsInt = (originalColor.x << 16) + (originalColor.y << 8) + originalColor.z;
|
|
62
63
|
if (Number.isNaN(colorAsInt)) {
|
|
63
64
|
return 0;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { vec3, vec3Cross, vec3Normalize, type Bounds3, type Vec3 } from "../../../abstract-3d.js";
|
|
3
|
-
import type { DxfDimensionDefinition } from "./dxf-dimension.js";
|
|
4
|
-
// oxlint-disable-next-line import/no-cycle -- both sides only call each other from function bodies
|
|
5
|
-
import { dxfEncFooter } from "./dxf-footer.js";
|
|
6
|
-
// oxlint-disable-next-line import/no-cycle -- both sides only call each other from function bodies
|
|
7
|
-
import { dxfEncHeader } from "./dxf-header.js";
|
|
1
|
+
import { vec3, vec3Cross, vec3Normalize, type Vec3 } from "../../../abstract-3d.js";
|
|
8
2
|
|
|
9
3
|
export const DEFAULT_CIRCLE_SIDE_COUNT = 16;
|
|
10
4
|
export const DXF_FONT_SIZE_RATIO: number = 11.0 / 20.0;
|
|
@@ -30,22 +24,6 @@ export function dxfRound(n: number): number {
|
|
|
30
24
|
return Math.round((n + Number.EPSILON) * 10 ** d) / 10 ** d;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
export function dxfBuild(
|
|
34
|
-
groups: string,
|
|
35
|
-
dimensions: DxfDimensionDefinition,
|
|
36
|
-
bounds: Bounds3,
|
|
37
|
-
size: Vec3,
|
|
38
|
-
center: Vec3
|
|
39
|
-
): string {
|
|
40
|
-
const id = generateUUID();
|
|
41
|
-
return (
|
|
42
|
-
dxfEncHeader(bounds, center, id, size, dimensions.block, dimensions.blockRecord) +
|
|
43
|
-
groups +
|
|
44
|
-
dimensions.entity +
|
|
45
|
-
dxfEncFooter(id)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
27
|
/*
|
|
50
28
|
given an extrusion vector(normal; tags 210/220/230),
|
|
51
29
|
calculate the dxf OCS x and y axises used to project
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { dimensionMeshifyAlignedDimension } from "../../../abstract-3d.js";
|
|
2
2
|
import type { DimensionAligned, View, Material, Vec3 } from "../../../abstract-3d.js";
|
|
3
3
|
import { type DxfColor, dxfColor } from "./dxf-color.js";
|
|
4
|
-
import {
|
|
5
|
-
DXF_BLOCK_RECORD_TABLE_HANDLE,
|
|
6
|
-
DXF_MODEL_SPACE_HANDLE,
|
|
7
|
-
dxfHandleNext,
|
|
8
|
-
dxfRound,
|
|
9
|
-
type Handle,
|
|
10
|
-
} from "./dxf-common.js";
|
|
4
|
+
import { DXF_BLOCK_RECORD_TABLE_HANDLE, DXF_MODEL_SPACE_HANDLE, dxfHandleNext, dxfRound, type Handle } from "./dxf-common.js";
|
|
11
5
|
import { dxfEncLine } from "./dxf-line.js";
|
|
12
6
|
import { DxfMTextAttachment, dxfEncMText, encodeDxfFormattedText } from "./dxf-mtext.js";
|
|
13
7
|
import { dxfEncSolidTriangle } from "./dxf-triangle.js";
|
|
@@ -207,25 +201,8 @@ function dxfEncodeDimensionGeometry(
|
|
|
207
201
|
const onCreateLine = (start: Vec3, end: Vec3, _norm: Vec3, _thickness: number, _mat: Material): void => {
|
|
208
202
|
entities += dxfEncLine(start, end, col, handleRef, blockRecordHandle);
|
|
209
203
|
};
|
|
210
|
-
const onCreateText = (
|
|
211
|
-
pos
|
|
212
|
-
measurement: string,
|
|
213
|
-
fontSize: number,
|
|
214
|
-
_mat: Material,
|
|
215
|
-
_rot: Vec3,
|
|
216
|
-
dir: Vec3,
|
|
217
|
-
norm: Vec3
|
|
218
|
-
): void => {
|
|
219
|
-
entities += dxfEncMText(
|
|
220
|
-
pos,
|
|
221
|
-
measurement,
|
|
222
|
-
dir,
|
|
223
|
-
norm,
|
|
224
|
-
fontSize,
|
|
225
|
-
handleRef,
|
|
226
|
-
DxfMTextAttachment.MiddleCenter,
|
|
227
|
-
blockRecordHandle
|
|
228
|
-
);
|
|
204
|
+
const onCreateText = (pos: Vec3, measurement: string, fontSize: number, _mat: Material, _rot: Vec3, dir: Vec3, norm: Vec3): void => {
|
|
205
|
+
entities += dxfEncMText(pos, measurement, dir, norm, fontSize, handleRef, DxfMTextAttachment.MiddleCenter, blockRecordHandle);
|
|
229
206
|
};
|
|
230
207
|
const onCreatePolygon = (p1: Vec3, p2: Vec3, p3: Vec3, _mat: Material): void => {
|
|
231
208
|
entities += dxfEncSolidTriangle(p1, p2, p3, col, handleRef, blockRecordHandle);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* oxlint-disable max-lines */
|
|
2
2
|
import type { Bounds3, Vec3 } from "../../../abstract-3d.js";
|
|
3
|
-
// oxlint-disable-next-line import/no-cycle -- both sides only call each other from function bodies
|
|
4
3
|
import { DXF_BLOCK_RECORD_TABLE_HANDLE, DXF_MODEL_SPACE_HANDLE } from "./dxf-common.js";
|
|
5
4
|
|
|
6
5
|
const DXF_MAKER = "DXF Generated from Divid Abstract 3D";
|
|
@@ -2,13 +2,7 @@ import type { Vec3 } from "../../../abstract-3d.js";
|
|
|
2
2
|
import { type DxfColor, dxfColor } from "./dxf-color.js";
|
|
3
3
|
import { DXF_MODEL_SPACE_HANDLE, dxfHandleNext, dxfRound, type Handle } from "./dxf-common.js";
|
|
4
4
|
|
|
5
|
-
export function dxfEncLine(
|
|
6
|
-
vecStart: Vec3,
|
|
7
|
-
vecEnd: Vec3,
|
|
8
|
-
col: DxfColor,
|
|
9
|
-
handleRef: Handle,
|
|
10
|
-
blockRefHandle?: string
|
|
11
|
-
): string {
|
|
5
|
+
export function dxfEncLine(vecStart: Vec3, vecEnd: Vec3, col: DxfColor, handleRef: Handle, blockRefHandle?: string): string {
|
|
12
6
|
return ` 0
|
|
13
7
|
LINE
|
|
14
8
|
5
|
|
@@ -2,13 +2,7 @@ import type { Vec3 } from "../../../abstract-3d.js";
|
|
|
2
2
|
import { type DxfColor, dxfColor } from "./dxf-color.js";
|
|
3
3
|
import { DXF_MODEL_SPACE_HANDLE, dxfHandleNext, dxfRound, type Handle } from "./dxf-common.js";
|
|
4
4
|
|
|
5
|
-
export function dxfEncPolyline(
|
|
6
|
-
points: ReadonlyArray<Vec3>,
|
|
7
|
-
col: DxfColor,
|
|
8
|
-
closed: boolean,
|
|
9
|
-
handleRef: Handle,
|
|
10
|
-
blockRefHandle?: string
|
|
11
|
-
): string {
|
|
5
|
+
export function dxfEncPolyline(points: ReadonlyArray<Vec3>, col: DxfColor, closed: boolean, handleRef: Handle, blockRefHandle?: string): string {
|
|
12
6
|
if (points.length < 2) {
|
|
13
7
|
return "";
|
|
14
8
|
}
|
|
@@ -2,15 +2,7 @@ import type { Vec3 } from "../../../abstract-3d.js";
|
|
|
2
2
|
import { type DxfColor, dxfColor } from "./dxf-color.js";
|
|
3
3
|
import { DXF_MODEL_SPACE_HANDLE, dxfHandleNext, dxfRound, type Handle } from "./dxf-common.js";
|
|
4
4
|
|
|
5
|
-
export const dxfEncSolid = (
|
|
6
|
-
vec1: Vec3,
|
|
7
|
-
vec2: Vec3,
|
|
8
|
-
vec3: Vec3,
|
|
9
|
-
vec4: Vec3,
|
|
10
|
-
col: DxfColor,
|
|
11
|
-
handleRef: Handle,
|
|
12
|
-
blockRefHandle?: string
|
|
13
|
-
): string => ` 0
|
|
5
|
+
export const dxfEncSolid = (vec1: Vec3, vec2: Vec3, vec3: Vec3, vec4: Vec3, col: DxfColor, handleRef: Handle, blockRefHandle?: string): string => ` 0
|
|
14
6
|
SOLID
|
|
15
7
|
5
|
|
16
8
|
${dxfHandleNext(handleRef)}
|