okgeometry-api 0.2.12 → 0.2.14
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/dist/Arc.d.ts +52 -2
- package/dist/Arc.d.ts.map +1 -1
- package/dist/Arc.js +50 -1
- package/dist/Arc.js.map +1 -1
- package/dist/BufferCodec.d.ts +118 -0
- package/dist/BufferCodec.d.ts.map +1 -0
- package/dist/BufferCodec.js +171 -0
- package/dist/BufferCodec.js.map +1 -0
- package/dist/Circle.d.ts +66 -12
- package/dist/Circle.d.ts.map +1 -1
- package/dist/Circle.js +64 -8
- package/dist/Circle.js.map +1 -1
- package/dist/Line.d.ts +53 -1
- package/dist/Line.d.ts.map +1 -1
- package/dist/Line.js +51 -0
- package/dist/Line.js.map +1 -1
- package/dist/Mesh.d.ts +167 -20
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +187 -70
- package/dist/Mesh.js.map +1 -1
- package/dist/NurbsCurve.d.ts +78 -8
- package/dist/NurbsCurve.d.ts.map +1 -1
- package/dist/NurbsCurve.js +76 -7
- package/dist/NurbsCurve.js.map +1 -1
- package/dist/NurbsSurface.d.ts +64 -14
- package/dist/NurbsSurface.d.ts.map +1 -1
- package/dist/NurbsSurface.js +65 -25
- package/dist/NurbsSurface.js.map +1 -1
- package/dist/Point.d.ts +65 -12
- package/dist/Point.d.ts.map +1 -1
- package/dist/Point.js +61 -2
- package/dist/Point.js.map +1 -1
- package/dist/PolyCurve.d.ts +4 -6
- package/dist/PolyCurve.d.ts.map +1 -1
- package/dist/PolyCurve.js +31 -16
- package/dist/PolyCurve.js.map +1 -1
- package/dist/Polygon.d.ts +35 -3
- package/dist/Polygon.d.ts.map +1 -1
- package/dist/Polygon.js +33 -2
- package/dist/Polygon.js.map +1 -1
- package/dist/Polyline.d.ts +67 -2
- package/dist/Polyline.d.ts.map +1 -1
- package/dist/Polyline.js +86 -13
- package/dist/Polyline.js.map +1 -1
- package/dist/Ray.d.ts +45 -0
- package/dist/Ray.d.ts.map +1 -0
- package/dist/Ray.js +68 -0
- package/dist/Ray.js.map +1 -0
- package/dist/Vec3.d.ts +76 -0
- package/dist/Vec3.d.ts.map +1 -1
- package/dist/Vec3.js +76 -0
- package/dist/Vec3.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -2
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/package.json +1 -1
- package/wasm/okgeometrycore.d.ts +27 -0
- package/wasm/okgeometrycore.js +1 -1
- package/wasm/okgeometrycore_bg.js +81 -0
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/okgeometrycore_bg.wasm.d.ts +4 -0
package/dist/Polyline.js
CHANGED
|
@@ -1,59 +1,132 @@
|
|
|
1
1
|
import { ensureInit } from "./engine.js";
|
|
2
2
|
import { Point } from "./Point.js";
|
|
3
3
|
import { Mesh } from "./Mesh.js";
|
|
4
|
+
import { Line } from "./Line.js";
|
|
5
|
+
import { PolyCurve } from "./PolyCurve.js";
|
|
6
|
+
import { pointsToCoords, coordsToPoints } from "./BufferCodec.js";
|
|
4
7
|
import * as wasm from "../wasm/okgeometrycore_bg.js";
|
|
8
|
+
/**
|
|
9
|
+
* Open or closed polyline defined by a sequence of points.
|
|
10
|
+
* Supports length, evaluation, transformation, and extrusion operations.
|
|
11
|
+
*/
|
|
5
12
|
export class Polyline {
|
|
6
13
|
constructor(points) {
|
|
7
14
|
this.points = points;
|
|
8
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the total length of this polyline.
|
|
18
|
+
* @returns Sum of segment lengths
|
|
19
|
+
*/
|
|
9
20
|
length() {
|
|
10
21
|
ensureInit();
|
|
11
22
|
return wasm.polyline_length(this.toCoords());
|
|
12
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Evaluate a point on the polyline at normalized parameter t.
|
|
26
|
+
* @param t - Parameter in [0, 1] (0 = first point, 1 = last point)
|
|
27
|
+
* @returns Point on polyline at parameter t
|
|
28
|
+
*/
|
|
13
29
|
pointAt(t) {
|
|
14
30
|
ensureInit();
|
|
15
31
|
const r = wasm.polyline_point_at(this.toCoords(), t);
|
|
16
32
|
return new Point(r[0], r[1], r[2]);
|
|
17
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if this polyline is closed.
|
|
36
|
+
* @param eps - Tolerance for comparing first and last points
|
|
37
|
+
* @returns True if first and last points coincide
|
|
38
|
+
*/
|
|
18
39
|
isClosed(eps = 1e-10) {
|
|
19
40
|
if (this.points.length < 2)
|
|
20
41
|
return false;
|
|
21
42
|
return this.points[0].equals(this.points[this.points.length - 1], eps);
|
|
22
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Extrude this polyline along a direction vector.
|
|
46
|
+
* @param direction - Extrusion direction and magnitude
|
|
47
|
+
* @param segments - Number of segments along extrusion (default 1)
|
|
48
|
+
* @param caps - Whether to cap the ends (default false)
|
|
49
|
+
* @returns Mesh representing the extruded surface
|
|
50
|
+
*/
|
|
23
51
|
extrude(direction, segments = 1, caps = false) {
|
|
24
52
|
ensureInit();
|
|
25
53
|
const buf = wasm.extrude_polyline(this.toCoords(), direction.x, direction.y, direction.z, segments, caps);
|
|
26
54
|
return Mesh.fromBuffer(buf);
|
|
27
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Translate this polyline by an offset vector.
|
|
58
|
+
* @param offset - Translation vector
|
|
59
|
+
* @returns New translated polyline
|
|
60
|
+
*/
|
|
28
61
|
translate(offset) {
|
|
29
62
|
return new Polyline(this.points.map(p => p.add(offset)));
|
|
30
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Rotate this polyline around an axis.
|
|
66
|
+
* @param axis - Rotation axis (Vec3 through origin, or Line for arbitrary axis)
|
|
67
|
+
* @param angle - Rotation angle in radians
|
|
68
|
+
* @returns New rotated polyline
|
|
69
|
+
*/
|
|
31
70
|
rotate(axis, angle) {
|
|
32
71
|
return new Polyline(this.points.map(p => p.rotate(axis, angle)));
|
|
33
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Offset this polyline perpendicular to its segments.
|
|
75
|
+
* @param distance - Offset distance
|
|
76
|
+
* @param normal - Reference normal for determining offset direction
|
|
77
|
+
* @returns New offset polyline
|
|
78
|
+
*/
|
|
34
79
|
offset(distance, normal) {
|
|
35
80
|
ensureInit();
|
|
36
81
|
const nx = normal?.x ?? 0, ny = normal?.y ?? 0, nz = normal?.z ?? 0;
|
|
37
82
|
const result = wasm.offset_polyline_curve(this.toCoords(), distance, nx, ny, nz);
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < result.length; i += 3) {
|
|
40
|
-
pts.push(new Point(result[i], result[i + 1], result[i + 2]));
|
|
41
|
-
}
|
|
42
|
-
return new Polyline(pts);
|
|
83
|
+
return new Polyline(coordsToPoints(result));
|
|
43
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Project this polyline onto a plane.
|
|
87
|
+
* @param plane - Target plane
|
|
88
|
+
* @param direction - Optional projection direction (default: perpendicular to plane)
|
|
89
|
+
* @returns New projected polyline
|
|
90
|
+
*/
|
|
44
91
|
projectOntoPlane(plane, direction) {
|
|
45
92
|
const proj = (p) => direction ? plane.projectPointAlongDirection(p, direction) : plane.projectPoint(p);
|
|
46
93
|
return new Polyline(this.points.map(proj));
|
|
47
94
|
}
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Fillet corners of this polyline with arcs of the given radius.
|
|
97
|
+
* @param radius - Fillet radius
|
|
98
|
+
* @param normal - Reference normal for arc orientation (auto-detected if not provided)
|
|
99
|
+
* @returns PolyCurve with Line and Arc segments
|
|
100
|
+
*/
|
|
101
|
+
fillet(radius, normal) {
|
|
102
|
+
ensureInit();
|
|
103
|
+
if (this.points.length < 3) {
|
|
104
|
+
throw new Error("Polyline.fillet() requires at least 3 points");
|
|
105
|
+
}
|
|
106
|
+
const nx = normal?.x ?? 0, ny = normal?.y ?? 0, nz = normal?.z ?? 0;
|
|
107
|
+
const buf = wasm.fillet_polycurve(this.toCoords(), radius, nx, ny, nz);
|
|
108
|
+
if (buf.length < 1) {
|
|
109
|
+
throw new Error("Polyline.fillet() failed - WASM returned empty result");
|
|
55
110
|
}
|
|
56
|
-
return
|
|
111
|
+
return PolyCurve.fromSegmentData(buf);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Convert this polyline to a PolyCurve (line segments only).
|
|
115
|
+
* @returns PolyCurve with Line segments connecting consecutive points
|
|
116
|
+
*/
|
|
117
|
+
toPolyCurve() {
|
|
118
|
+
const segs = [];
|
|
119
|
+
for (let i = 0; i < this.points.length - 1; i++) {
|
|
120
|
+
segs.push(new Line(this.points[i], this.points[i + 1]));
|
|
121
|
+
}
|
|
122
|
+
return new PolyCurve(segs);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Convert points to flat coordinate array for WASM.
|
|
126
|
+
* @returns Float64Array [x1,y1,z1, x2,y2,z2, ...]
|
|
127
|
+
*/
|
|
128
|
+
toCoords() {
|
|
129
|
+
return pointsToCoords(this.points);
|
|
57
130
|
}
|
|
58
131
|
}
|
|
59
132
|
//# sourceMappingURL=Polyline.js.map
|
package/dist/Polyline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../src/Polyline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,E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AC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACK,QAAQ;QACd,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF"}
|
package/dist/Ray.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Point } from "./Point.js";
|
|
2
|
+
import { Vec3 } from "./Vec3.js";
|
|
3
|
+
/**
|
|
4
|
+
* 3D ray defined by origin and direction.
|
|
5
|
+
* Parametric form: point(t) = origin + t * direction
|
|
6
|
+
*/
|
|
7
|
+
export declare class Ray {
|
|
8
|
+
readonly origin: Point;
|
|
9
|
+
readonly direction: Vec3;
|
|
10
|
+
constructor(origin: Point, direction: Vec3);
|
|
11
|
+
/**
|
|
12
|
+
* Create a ray from origin and direction, normalizing the direction.
|
|
13
|
+
* Returns null if direction is zero-length.
|
|
14
|
+
*/
|
|
15
|
+
static fromOriginDirection(origin: Point, direction: Vec3): Ray | null;
|
|
16
|
+
/**
|
|
17
|
+
* Get point along the ray at parameter t.
|
|
18
|
+
* Returns origin + t * direction
|
|
19
|
+
*/
|
|
20
|
+
pointAt(t: number): Point;
|
|
21
|
+
/**
|
|
22
|
+
* Find the parameter t for the closest point on the ray to a given point.
|
|
23
|
+
* The closest point is at: origin + t * direction
|
|
24
|
+
* Note: t can be negative if the closest point is "behind" the ray origin,
|
|
25
|
+
* but closestPoint() clamps t >= 0.
|
|
26
|
+
*/
|
|
27
|
+
closestPointParameter(point: Point): number;
|
|
28
|
+
/**
|
|
29
|
+
* Find the closest point on the ray to a given point.
|
|
30
|
+
* The result is clamped to the ray (t >= 0), so if the closest
|
|
31
|
+
* point would be "behind" the origin, returns the origin.
|
|
32
|
+
*/
|
|
33
|
+
closestPoint(point: Point): Point;
|
|
34
|
+
/**
|
|
35
|
+
* Compute the distance from this ray to a point.
|
|
36
|
+
* This is the perpendicular distance from the ray to the point,
|
|
37
|
+
* clamped so that the closest point is on the ray (t >= 0).
|
|
38
|
+
*/
|
|
39
|
+
distanceToPoint(point: Point): number;
|
|
40
|
+
/**
|
|
41
|
+
* Translate the ray by an offset vector.
|
|
42
|
+
*/
|
|
43
|
+
translate(offset: Vec3): Ray;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Ray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ray.d.ts","sourceRoot":"","sources":["../src/Ray.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;GAGG;AACH,qBAAa,GAAG;aAEI,MAAM,EAAE,KAAK;aACb,SAAS,EAAE,IAAI;gBADf,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,IAAI;IAGjC;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,IAAI;IAMtE;;;OAGG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK;IAUzB;;;;;OAKG;IACH,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAS3C;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAUjC;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IASrC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG;CAG7B"}
|
package/dist/Ray.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ensureInit } from "./engine.js";
|
|
2
|
+
import { Point } from "./Point.js";
|
|
3
|
+
import * as wasm from "../wasm/okgeometrycore_bg.js";
|
|
4
|
+
/**
|
|
5
|
+
* 3D ray defined by origin and direction.
|
|
6
|
+
* Parametric form: point(t) = origin + t * direction
|
|
7
|
+
*/
|
|
8
|
+
export class Ray {
|
|
9
|
+
constructor(origin, direction) {
|
|
10
|
+
this.origin = origin;
|
|
11
|
+
this.direction = direction;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a ray from origin and direction, normalizing the direction.
|
|
15
|
+
* Returns null if direction is zero-length.
|
|
16
|
+
*/
|
|
17
|
+
static fromOriginDirection(origin, direction) {
|
|
18
|
+
const normalized = direction.normalize();
|
|
19
|
+
if (normalized.length() < 1e-10)
|
|
20
|
+
return null;
|
|
21
|
+
return new Ray(origin, normalized);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get point along the ray at parameter t.
|
|
25
|
+
* Returns origin + t * direction
|
|
26
|
+
*/
|
|
27
|
+
pointAt(t) {
|
|
28
|
+
ensureInit();
|
|
29
|
+
const r = wasm.ray_point_at(this.origin.x, this.origin.y, this.origin.z, this.direction.x, this.direction.y, this.direction.z, t);
|
|
30
|
+
return new Point(r[0], r[1], r[2]);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Find the parameter t for the closest point on the ray to a given point.
|
|
34
|
+
* The closest point is at: origin + t * direction
|
|
35
|
+
* Note: t can be negative if the closest point is "behind" the ray origin,
|
|
36
|
+
* but closestPoint() clamps t >= 0.
|
|
37
|
+
*/
|
|
38
|
+
closestPointParameter(point) {
|
|
39
|
+
ensureInit();
|
|
40
|
+
return wasm.ray_closest_point_parameter(this.origin.x, this.origin.y, this.origin.z, this.direction.x, this.direction.y, this.direction.z, point.x, point.y, point.z);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Find the closest point on the ray to a given point.
|
|
44
|
+
* The result is clamped to the ray (t >= 0), so if the closest
|
|
45
|
+
* point would be "behind" the origin, returns the origin.
|
|
46
|
+
*/
|
|
47
|
+
closestPoint(point) {
|
|
48
|
+
ensureInit();
|
|
49
|
+
const r = wasm.ray_closest_point(this.origin.x, this.origin.y, this.origin.z, this.direction.x, this.direction.y, this.direction.z, point.x, point.y, point.z);
|
|
50
|
+
return new Point(r[0], r[1], r[2]);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Compute the distance from this ray to a point.
|
|
54
|
+
* This is the perpendicular distance from the ray to the point,
|
|
55
|
+
* clamped so that the closest point is on the ray (t >= 0).
|
|
56
|
+
*/
|
|
57
|
+
distanceToPoint(point) {
|
|
58
|
+
ensureInit();
|
|
59
|
+
return wasm.ray_distance_to_point(this.origin.x, this.origin.y, this.origin.z, this.direction.x, this.direction.y, this.direction.z, point.x, point.y, point.z);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Translate the ray by an offset vector.
|
|
63
|
+
*/
|
|
64
|
+
translate(offset) {
|
|
65
|
+
return new Ray(this.origin.add(offset), this.direction);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=Ray.js.map
|
package/dist/Ray.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ray.js","sourceRoot":"","sources":["../src/Ray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,GAAG;IACd,YACkB,MAAa,EACb,SAAe;QADf,WAAM,GAAN,MAAM,CAAO;QACb,cAAS,GAAT,SAAS,CAAM;IAC9B,CAAC;IAEJ;;;OAGG;IACH,MAAM,CAAC,mBAAmB,C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AC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAC3C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EACpD,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAC1B,CAAC;QACF,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,KAAY;QAC1B,UAAU,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,qBAAqB,CAC/B,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAC3C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EACpD,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAC1B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAAY;QACpB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
package/dist/Vec3.d.ts
CHANGED
|
@@ -1,25 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable 3D vector for representing directions and offsets.
|
|
3
|
+
* All operations return new Vec3 instances.
|
|
4
|
+
*/
|
|
1
5
|
export declare class Vec3 {
|
|
2
6
|
readonly x: number;
|
|
3
7
|
readonly y: number;
|
|
4
8
|
readonly z: number;
|
|
5
9
|
constructor(x: number, y: number, z: number);
|
|
10
|
+
/**
|
|
11
|
+
* Add another vector to this one.
|
|
12
|
+
* @param v - Vector to add
|
|
13
|
+
* @returns New vector representing the sum
|
|
14
|
+
*/
|
|
6
15
|
add(v: Vec3): Vec3;
|
|
16
|
+
/**
|
|
17
|
+
* Subtract another vector from this one.
|
|
18
|
+
* @param v - Vector to subtract
|
|
19
|
+
* @returns New vector representing the difference
|
|
20
|
+
*/
|
|
7
21
|
sub(v: Vec3): Vec3;
|
|
22
|
+
/**
|
|
23
|
+
* Scale this vector by a scalar value.
|
|
24
|
+
* @param s - Scalar multiplier
|
|
25
|
+
* @returns New scaled vector
|
|
26
|
+
*/
|
|
8
27
|
scale(s: number): Vec3;
|
|
28
|
+
/**
|
|
29
|
+
* Compute the dot product with another vector.
|
|
30
|
+
* @param v - Vector to dot with
|
|
31
|
+
* @returns Scalar dot product value
|
|
32
|
+
*/
|
|
9
33
|
dot(v: Vec3): number;
|
|
34
|
+
/**
|
|
35
|
+
* Compute the cross product with another vector.
|
|
36
|
+
* @param v - Vector to cross with
|
|
37
|
+
* @returns New vector perpendicular to both inputs
|
|
38
|
+
*/
|
|
10
39
|
cross(v: Vec3): Vec3;
|
|
40
|
+
/**
|
|
41
|
+
* Get the magnitude (length) of this vector.
|
|
42
|
+
* @returns Euclidean length
|
|
43
|
+
*/
|
|
11
44
|
length(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Get a unit vector in the same direction.
|
|
47
|
+
* Returns zero vector if length is zero.
|
|
48
|
+
* @returns Normalized unit vector
|
|
49
|
+
*/
|
|
12
50
|
normalize(): Vec3;
|
|
51
|
+
/**
|
|
52
|
+
* Compute the distance to another vector.
|
|
53
|
+
* @param v - Target vector
|
|
54
|
+
* @returns Euclidean distance between vectors
|
|
55
|
+
*/
|
|
13
56
|
distance(v: Vec3): number;
|
|
57
|
+
/**
|
|
58
|
+
* Linear interpolation between this vector and another.
|
|
59
|
+
* @param v - Target vector
|
|
60
|
+
* @param t - Parameter in [0, 1] (0 = this, 1 = v)
|
|
61
|
+
* @returns Interpolated vector
|
|
62
|
+
*/
|
|
14
63
|
lerp(v: Vec3, t: number): Vec3;
|
|
64
|
+
/**
|
|
65
|
+
* Get the negation of this vector.
|
|
66
|
+
* @returns Vector pointing in opposite direction
|
|
67
|
+
*/
|
|
15
68
|
negate(): Vec3;
|
|
69
|
+
/**
|
|
70
|
+
* Create a copy of this vector.
|
|
71
|
+
* @returns New vector with same components
|
|
72
|
+
*/
|
|
16
73
|
clone(): Vec3;
|
|
74
|
+
/**
|
|
75
|
+
* Check equality with another vector within tolerance.
|
|
76
|
+
* @param v - Vector to compare
|
|
77
|
+
* @param eps - Tolerance (default 1e-10)
|
|
78
|
+
* @returns True if vectors are approximately equal
|
|
79
|
+
*/
|
|
17
80
|
equals(v: Vec3, eps?: number): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Convert to array format.
|
|
83
|
+
* @returns Tuple [x, y, z]
|
|
84
|
+
*/
|
|
18
85
|
toArray(): [number, number, number];
|
|
86
|
+
/**
|
|
87
|
+
* Create a Vec3 from a plain object or JSON.
|
|
88
|
+
* @param json - Object with x, y, z properties
|
|
89
|
+
* @returns New Vec3 instance
|
|
90
|
+
*/
|
|
19
91
|
static fromJSON(json: any): Vec3;
|
|
92
|
+
/** Zero vector (0, 0, 0) */
|
|
20
93
|
static readonly ZERO: Vec3;
|
|
94
|
+
/** Unit X axis (1, 0, 0) */
|
|
21
95
|
static readonly X: Vec3;
|
|
96
|
+
/** Unit Y axis (0, 1, 0) */
|
|
22
97
|
static readonly Y: Vec3;
|
|
98
|
+
/** Unit Z axis (0, 0, 1) */
|
|
23
99
|
static readonly Z: Vec3;
|
|
24
100
|
}
|
|
25
101
|
//# sourceMappingURL=Vec3.d.ts.map
|
package/dist/Vec3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vec3.d.ts","sourceRoot":"","sources":["../src/V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+
* Immutable 3D vector for representing directions and offsets.
|
|
3
|
+
* All operations return new Vec3 instances.
|
|
4
|
+
*/
|
|
1
5
|
export class Vec3 {
|
|
2
6
|
constructor(x, y, z) {
|
|
3
7
|
this.x = x;
|
|
4
8
|
this.y = y;
|
|
5
9
|
this.z = z;
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Add another vector to this one.
|
|
13
|
+
* @param v - Vector to add
|
|
14
|
+
* @returns New vector representing the sum
|
|
15
|
+
*/
|
|
7
16
|
add(v) {
|
|
8
17
|
return new Vec3(this.x + v.x, this.y + v.y, this.z + v.z);
|
|
9
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Subtract another vector from this one.
|
|
21
|
+
* @param v - Vector to subtract
|
|
22
|
+
* @returns New vector representing the difference
|
|
23
|
+
*/
|
|
10
24
|
sub(v) {
|
|
11
25
|
return new Vec3(this.x - v.x, this.y - v.y, this.z - v.z);
|
|
12
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Scale this vector by a scalar value.
|
|
29
|
+
* @param s - Scalar multiplier
|
|
30
|
+
* @returns New scaled vector
|
|
31
|
+
*/
|
|
13
32
|
scale(s) {
|
|
14
33
|
return new Vec3(this.x * s, this.y * s, this.z * s);
|
|
15
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Compute the dot product with another vector.
|
|
37
|
+
* @param v - Vector to dot with
|
|
38
|
+
* @returns Scalar dot product value
|
|
39
|
+
*/
|
|
16
40
|
dot(v) {
|
|
17
41
|
return this.x * v.x + this.y * v.y + this.z * v.z;
|
|
18
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Compute the cross product with another vector.
|
|
45
|
+
* @param v - Vector to cross with
|
|
46
|
+
* @returns New vector perpendicular to both inputs
|
|
47
|
+
*/
|
|
19
48
|
cross(v) {
|
|
20
49
|
return new Vec3(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x);
|
|
21
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the magnitude (length) of this vector.
|
|
53
|
+
* @returns Euclidean length
|
|
54
|
+
*/
|
|
22
55
|
length() {
|
|
23
56
|
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
24
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Get a unit vector in the same direction.
|
|
60
|
+
* Returns zero vector if length is zero.
|
|
61
|
+
* @returns Normalized unit vector
|
|
62
|
+
*/
|
|
25
63
|
normalize() {
|
|
26
64
|
const len = this.length();
|
|
27
65
|
if (len === 0)
|
|
28
66
|
return new Vec3(0, 0, 0);
|
|
29
67
|
return this.scale(1 / len);
|
|
30
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Compute the distance to another vector.
|
|
71
|
+
* @param v - Target vector
|
|
72
|
+
* @returns Euclidean distance between vectors
|
|
73
|
+
*/
|
|
31
74
|
distance(v) {
|
|
32
75
|
return this.sub(v).length();
|
|
33
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Linear interpolation between this vector and another.
|
|
79
|
+
* @param v - Target vector
|
|
80
|
+
* @param t - Parameter in [0, 1] (0 = this, 1 = v)
|
|
81
|
+
* @returns Interpolated vector
|
|
82
|
+
*/
|
|
34
83
|
lerp(v, t) {
|
|
35
84
|
return new Vec3(this.x + (v.x - this.x) * t, this.y + (v.y - this.y) * t, this.z + (v.z - this.z) * t);
|
|
36
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the negation of this vector.
|
|
88
|
+
* @returns Vector pointing in opposite direction
|
|
89
|
+
*/
|
|
37
90
|
negate() {
|
|
38
91
|
return new Vec3(-this.x, -this.y, -this.z);
|
|
39
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a copy of this vector.
|
|
95
|
+
* @returns New vector with same components
|
|
96
|
+
*/
|
|
40
97
|
clone() {
|
|
41
98
|
return new Vec3(this.x, this.y, this.z);
|
|
42
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Check equality with another vector within tolerance.
|
|
102
|
+
* @param v - Vector to compare
|
|
103
|
+
* @param eps - Tolerance (default 1e-10)
|
|
104
|
+
* @returns True if vectors are approximately equal
|
|
105
|
+
*/
|
|
43
106
|
equals(v, eps = 1e-10) {
|
|
44
107
|
return (Math.abs(this.x - v.x) < eps &&
|
|
45
108
|
Math.abs(this.y - v.y) < eps &&
|
|
46
109
|
Math.abs(this.z - v.z) < eps);
|
|
47
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Convert to array format.
|
|
113
|
+
* @returns Tuple [x, y, z]
|
|
114
|
+
*/
|
|
48
115
|
toArray() {
|
|
49
116
|
return [this.x, this.y, this.z];
|
|
50
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Create a Vec3 from a plain object or JSON.
|
|
120
|
+
* @param json - Object with x, y, z properties
|
|
121
|
+
* @returns New Vec3 instance
|
|
122
|
+
*/
|
|
51
123
|
static fromJSON(json) {
|
|
52
124
|
if (json instanceof Vec3)
|
|
53
125
|
return json;
|
|
54
126
|
return new Vec3(json.x ?? 0, json.y ?? 0, json.z ?? 0);
|
|
55
127
|
}
|
|
56
128
|
}
|
|
129
|
+
/** Zero vector (0, 0, 0) */
|
|
57
130
|
Vec3.ZERO = new Vec3(0, 0, 0);
|
|
131
|
+
/** Unit X axis (1, 0, 0) */
|
|
58
132
|
Vec3.X = new Vec3(1, 0, 0);
|
|
133
|
+
/** Unit Y axis (0, 1, 0) */
|
|
59
134
|
Vec3.Y = new Vec3(0, 1, 0);
|
|
135
|
+
/** Unit Z axis (0, 0, 1) */
|
|
60
136
|
Vec3.Z = new Vec3(0, 0, 1);
|
|
61
137
|
//# sourceMappingURL=Vec3.js.map
|
package/dist/Vec3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vec3.js","sourceRoot":"","sources":["../src/Vec3.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,IAAI;IACf,YACkB,CAAS,EACT,CAAS,EACT,CAAS;QAFT,MAAC,GAAD,CAAC,CA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AAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG;YAC5B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAC7B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAS;QACvB,IAAI,IAAI,YAAY,IAAI;YAAE,OAAO,IAAI,CAAC;QACtC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;;AAED,4BAA4B;AACZ,SAAI,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,4BAA4B;AACZ,MAAC,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACtC,4BAA4B;AACZ,MAAC,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACtC,4BAA4B;AACZ,MAAC,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAKA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAe1C;AAED,wBAAgB,UAAU,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAKA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAe1C;AAED,wBAAgB,UAAU,IAAI,IAAI,CAIjC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC"}
|
package/dist/engine.js
CHANGED
|
@@ -17,8 +17,9 @@ export async function init() {
|
|
|
17
17
|
initialized = true;
|
|
18
18
|
}
|
|
19
19
|
export function ensureInit() {
|
|
20
|
-
if (!initialized)
|
|
21
|
-
throw new Error("Call init()
|
|
20
|
+
if (!initialized) {
|
|
21
|
+
throw new Error("OkGeometry WASM not initialized. Call `await init()` before using geometry operations.");
|
|
22
|
+
}
|
|
22
23
|
}
|
|
23
24
|
export function isInitialized() {
|
|
24
25
|
return initialized;
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEnD,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,IAAI,WAAW;QAAE,OAAO;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAElE,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,UAAU,EAAE;QACzD,wBAA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M,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;IAC5G,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export { init, isInitialized } from "./engine.js";
|
|
2
|
+
export type { SweepableCurve, LoftableCurve, RotationAxis, CurveSegment, } from "./types.js";
|
|
3
|
+
export { CurveTypeCode, SegmentTypeCode } from "./types.js";
|
|
4
|
+
export { pointsToCoords, coordsToPoints, parsePolylineBuffer, parseIntersectionPoints, } from "./BufferCodec.js";
|
|
2
5
|
export { Vec3 } from "./Vec3.js";
|
|
3
6
|
export { Point } from "./Point.js";
|
|
4
7
|
export { Plane } from "./Plane.js";
|
|
5
|
-
export {
|
|
8
|
+
export { Ray } from "./Ray.js";
|
|
6
9
|
export { Line } from "./Line.js";
|
|
7
10
|
export { Circle } from "./Circle.js";
|
|
8
11
|
export { Arc } from "./Arc.js";
|
|
9
12
|
export { Polyline } from "./Polyline.js";
|
|
10
|
-
export { PolyCurve } from "./PolyCurve.js";
|
|
11
13
|
export { Polygon } from "./Polygon.js";
|
|
14
|
+
export { PolyCurve } from "./PolyCurve.js";
|
|
12
15
|
export { NurbsCurve } from "./NurbsCurve.js";
|
|
13
16
|
export { NurbsSurface } from "./NurbsSurface.js";
|
|
14
|
-
export
|
|
15
|
-
export type { SweepableCurve } from "./Mesh.js";
|
|
17
|
+
export { Mesh } from "./Mesh.js";
|
|
16
18
|
export { intersect } from "./Geometry.js";
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGlD,YAAY,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
// Core initialization
|
|
1
2
|
export { init, isInitialized } from "./engine.js";
|
|
3
|
+
export { pointsToCoords, coordsToPoints, parsePolylineBuffer, parseIntersectionPoints, } from "./BufferCodec.js";
|
|
4
|
+
// Primitive types
|
|
2
5
|
export { Vec3 } from "./Vec3.js";
|
|
3
6
|
export { Point } from "./Point.js";
|
|
4
7
|
export { Plane } from "./Plane.js";
|
|
5
|
-
export {
|
|
8
|
+
export { Ray } from "./Ray.js";
|
|
9
|
+
// Curve types
|
|
6
10
|
export { Line } from "./Line.js";
|
|
7
11
|
export { Circle } from "./Circle.js";
|
|
8
12
|
export { Arc } from "./Arc.js";
|
|
9
13
|
export { Polyline } from "./Polyline.js";
|
|
10
|
-
export { PolyCurve } from "./PolyCurve.js";
|
|
11
14
|
export { Polygon } from "./Polygon.js";
|
|
15
|
+
export { PolyCurve } from "./PolyCurve.js";
|
|
12
16
|
export { NurbsCurve } from "./NurbsCurve.js";
|
|
13
17
|
export { NurbsSurface } from "./NurbsSurface.js";
|
|
18
|
+
// Mesh and operations
|
|
19
|
+
export { Mesh } from "./Mesh.js";
|
|
14
20
|
export { intersect } from "./Geometry.js";
|
|
15
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAE1B,kBAAkB;AAClB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,cAAc;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,sBAAsB;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
|