@mlightcad/geometry-engine 1.0.0
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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/geometry-engine.js +10186 -0
- package/dist/geometry-engine.umd.cjs +4 -0
- package/lib/geometry/AcGeArea2d.d.ts +61 -0
- package/lib/geometry/AcGeArea2d.d.ts.map +1 -0
- package/lib/geometry/AcGeArea2d.js +174 -0
- package/lib/geometry/AcGeArea2d.js.map +1 -0
- package/lib/geometry/AcGeCircArc2d.d.ts +108 -0
- package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -0
- package/lib/geometry/AcGeCircArc2d.js +412 -0
- package/lib/geometry/AcGeCircArc2d.js.map +1 -0
- package/lib/geometry/AcGeCircArc3d.d.ts +138 -0
- package/lib/geometry/AcGeCircArc3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCircArc3d.js +447 -0
- package/lib/geometry/AcGeCircArc3d.js.map +1 -0
- package/lib/geometry/AcGeCurve2d.d.ts +85 -0
- package/lib/geometry/AcGeCurve2d.d.ts.map +1 -0
- package/lib/geometry/AcGeCurve2d.js +213 -0
- package/lib/geometry/AcGeCurve2d.js.map +1 -0
- package/lib/geometry/AcGeCurve3d.d.ts +27 -0
- package/lib/geometry/AcGeCurve3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCurve3d.js +29 -0
- package/lib/geometry/AcGeCurve3d.js.map +1 -0
- package/lib/geometry/AcGeEllipseArc2d.d.ts +105 -0
- package/lib/geometry/AcGeEllipseArc2d.d.ts.map +1 -0
- package/lib/geometry/AcGeEllipseArc2d.js +292 -0
- package/lib/geometry/AcGeEllipseArc2d.js.map +1 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts +141 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -0
- package/lib/geometry/AcGeEllipseArc3d.js +442 -0
- package/lib/geometry/AcGeEllipseArc3d.js.map +1 -0
- package/lib/geometry/AcGeLine2d.d.ts +56 -0
- package/lib/geometry/AcGeLine2d.d.ts.map +1 -0
- package/lib/geometry/AcGeLine2d.js +125 -0
- package/lib/geometry/AcGeLine2d.js.map +1 -0
- package/lib/geometry/AcGeLine3d.d.ts +134 -0
- package/lib/geometry/AcGeLine3d.d.ts.map +1 -0
- package/lib/geometry/AcGeLine3d.js +291 -0
- package/lib/geometry/AcGeLine3d.js.map +1 -0
- package/lib/geometry/AcGeLoop2d.d.ts +59 -0
- package/lib/geometry/AcGeLoop2d.d.ts.map +1 -0
- package/lib/geometry/AcGeLoop2d.js +141 -0
- package/lib/geometry/AcGeLoop2d.js.map +1 -0
- package/lib/geometry/AcGePolyline2d.d.ts +90 -0
- package/lib/geometry/AcGePolyline2d.d.ts.map +1 -0
- package/lib/geometry/AcGePolyline2d.js +224 -0
- package/lib/geometry/AcGePolyline2d.js.map +1 -0
- package/lib/geometry/AcGeShape.d.ts +12 -0
- package/lib/geometry/AcGeShape.d.ts.map +1 -0
- package/lib/geometry/AcGeShape.js +22 -0
- package/lib/geometry/AcGeShape.js.map +1 -0
- package/lib/geometry/AcGeShape2d.d.ts +31 -0
- package/lib/geometry/AcGeShape2d.d.ts.map +1 -0
- package/lib/geometry/AcGeShape2d.js +51 -0
- package/lib/geometry/AcGeShape2d.js.map +1 -0
- package/lib/geometry/AcGeShape3d.d.ts +33 -0
- package/lib/geometry/AcGeShape3d.d.ts.map +1 -0
- package/lib/geometry/AcGeShape3d.js +52 -0
- package/lib/geometry/AcGeShape3d.js.map +1 -0
- package/lib/geometry/AcGeSpline3d.d.ts +77 -0
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -0
- package/lib/geometry/AcGeSpline3d.js +221 -0
- package/lib/geometry/AcGeSpline3d.js.map +1 -0
- package/lib/geometry/index.d.ts +13 -0
- package/lib/geometry/index.d.ts.map +1 -0
- package/lib/geometry/index.js +13 -0
- package/lib/geometry/index.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/lib/math/AcGeBox2d.d.ts +173 -0
- package/lib/math/AcGeBox2d.d.ts.map +1 -0
- package/lib/math/AcGeBox2d.js +289 -0
- package/lib/math/AcGeBox2d.js.map +1 -0
- package/lib/math/AcGeBox3d.d.ts +195 -0
- package/lib/math/AcGeBox3d.d.ts.map +1 -0
- package/lib/math/AcGeBox3d.js +378 -0
- package/lib/math/AcGeBox3d.js.map +1 -0
- package/lib/math/AcGeEuler.d.ts +133 -0
- package/lib/math/AcGeEuler.d.ts.map +1 -0
- package/lib/math/AcGeEuler.js +358 -0
- package/lib/math/AcGeEuler.js.map +1 -0
- package/lib/math/AcGeMatrix2d.d.ts +203 -0
- package/lib/math/AcGeMatrix2d.d.ts.map +1 -0
- package/lib/math/AcGeMatrix2d.js +393 -0
- package/lib/math/AcGeMatrix2d.js.map +1 -0
- package/lib/math/AcGeMatrix3d.d.ts +279 -0
- package/lib/math/AcGeMatrix3d.d.ts.map +1 -0
- package/lib/math/AcGeMatrix3d.js +1037 -0
- package/lib/math/AcGeMatrix3d.js.map +1 -0
- package/lib/math/AcGePlane.d.ts +131 -0
- package/lib/math/AcGePlane.d.ts.map +1 -0
- package/lib/math/AcGePlane.js +218 -0
- package/lib/math/AcGePlane.js.map +1 -0
- package/lib/math/AcGePoint.d.ts +4 -0
- package/lib/math/AcGePoint.d.ts.map +1 -0
- package/lib/math/AcGePoint.js +2 -0
- package/lib/math/AcGePoint.js.map +1 -0
- package/lib/math/AcGePoint2d.d.ts +17 -0
- package/lib/math/AcGePoint2d.d.ts.map +1 -0
- package/lib/math/AcGePoint2d.js +40 -0
- package/lib/math/AcGePoint2d.js.map +1 -0
- package/lib/math/AcGePoint3d.d.ts +18 -0
- package/lib/math/AcGePoint3d.d.ts.map +1 -0
- package/lib/math/AcGePoint3d.js +43 -0
- package/lib/math/AcGePoint3d.js.map +1 -0
- package/lib/math/AcGeQuaternion.d.ts +230 -0
- package/lib/math/AcGeQuaternion.d.ts.map +1 -0
- package/lib/math/AcGeQuaternion.js +666 -0
- package/lib/math/AcGeQuaternion.js.map +1 -0
- package/lib/math/AcGeVector.d.ts +9 -0
- package/lib/math/AcGeVector.d.ts.map +1 -0
- package/lib/math/AcGeVector.js +2 -0
- package/lib/math/AcGeVector.js.map +1 -0
- package/lib/math/AcGeVector2d.d.ts +361 -0
- package/lib/math/AcGeVector2d.d.ts.map +1 -0
- package/lib/math/AcGeVector2d.js +622 -0
- package/lib/math/AcGeVector2d.js.map +1 -0
- package/lib/math/AcGeVector3d.d.ts +493 -0
- package/lib/math/AcGeVector3d.d.ts.map +1 -0
- package/lib/math/AcGeVector3d.js +868 -0
- package/lib/math/AcGeVector3d.js.map +1 -0
- package/lib/math/index.d.ts +14 -0
- package/lib/math/index.d.ts.map +1 -0
- package/lib/math/index.js +14 -0
- package/lib/math/index.js.map +1 -0
- package/lib/util/AcGeConstants.d.ts +19 -0
- package/lib/util/AcGeConstants.d.ts.map +1 -0
- package/lib/util/AcGeConstants.js +25 -0
- package/lib/util/AcGeConstants.js.map +1 -0
- package/lib/util/AcGeGeometryUtil.d.ts +16 -0
- package/lib/util/AcGeGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcGeGeometryUtil.js +56 -0
- package/lib/util/AcGeGeometryUtil.js.map +1 -0
- package/lib/util/AcGeMathUtil.d.ts +203 -0
- package/lib/util/AcGeMathUtil.d.ts.map +1 -0
- package/lib/util/AcGeMathUtil.js +585 -0
- package/lib/util/AcGeMathUtil.js.map +1 -0
- package/lib/util/AcGeTol.d.ts +91 -0
- package/lib/util/AcGeTol.d.ts.map +1 -0
- package/lib/util/AcGeTol.js +83 -0
- package/lib/util/AcGeTol.js.map +1 -0
- package/lib/util/index.d.ts +5 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +5 -0
- package/lib/util/index.js.map +1 -0
- package/package.json +42 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d, AcGePoint3d } from '../math';
|
2
|
+
import { AcGeCurve2d } from './AcGeCurve2d';
|
3
|
+
/**
|
4
|
+
* The class represents one vertex of the polyline geometry.
|
5
|
+
*/
|
6
|
+
export interface AcGePolyline2dVertex {
|
7
|
+
x: number;
|
8
|
+
y: number;
|
9
|
+
/**
|
10
|
+
* The bulge factor used to indicate how much of an arc segment is present at this vertex.
|
11
|
+
* The bulge factor is the tangent of one fourth the included angle for an arc segment, made
|
12
|
+
* negative if the arc goes clockwise from the start point to the endpoint. A bulge of 0 indicates a
|
13
|
+
* straight segment, and a bulge of 1 is a semicircle. Get more details from the following links.
|
14
|
+
* - https://ezdxf.readthedocs.io/en/stable/dxfentities/lwpolyline.html
|
15
|
+
* - https://www.afralisp.net/archive/lisp/Bulges1.htm
|
16
|
+
*/
|
17
|
+
bulge?: number;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* The class represents the polyline geometry.
|
21
|
+
*/
|
22
|
+
export declare class AcGePolyline2d<T extends AcGePolyline2dVertex = AcGePolyline2dVertex> extends AcGeCurve2d {
|
23
|
+
private _closed;
|
24
|
+
private _vertices;
|
25
|
+
constructor(vertices?: Array<T> | null, closed?: boolean);
|
26
|
+
/**
|
27
|
+
* The number of vertices in the polyline
|
28
|
+
*/
|
29
|
+
get numberOfVertices(): number;
|
30
|
+
/**
|
31
|
+
* @inheritdoc
|
32
|
+
*/
|
33
|
+
get closed(): boolean;
|
34
|
+
/**
|
35
|
+
* Start point of this polyline
|
36
|
+
*/
|
37
|
+
get startPoint(): AcGePoint2d;
|
38
|
+
/**
|
39
|
+
* End point of this polyline
|
40
|
+
*/
|
41
|
+
get endPoint(): AcGePoint2d;
|
42
|
+
/**
|
43
|
+
* @inheritdoc
|
44
|
+
*/
|
45
|
+
get length(): number;
|
46
|
+
/**
|
47
|
+
* Set the polyline to be closed (that is, there is a segment drawn from the last vertex to the first)
|
48
|
+
* if 'value' is true. Set the polyline to be open (no segment between the last and first vertices) if
|
49
|
+
* 'value' is false.
|
50
|
+
*/
|
51
|
+
set closed(value: boolean);
|
52
|
+
/**
|
53
|
+
* This function adds a vertex to the polyline. If index is 0, the vertex will become the first
|
54
|
+
* vertex of the polyline. If index is the value returned by this.numberOfVertices, then the vertex
|
55
|
+
* will become the last vertex of the polyline. Otherwise the vertex will be added just before the
|
56
|
+
* index vertex.
|
57
|
+
*
|
58
|
+
* @param index Input index (0 based) before which to insert the vertex
|
59
|
+
* @param vertex Input vertex location point
|
60
|
+
*/
|
61
|
+
addVertexAt(index: number, vertex: T): void;
|
62
|
+
/**
|
63
|
+
* Get the 2d location of the vertex index in the polyline's own object coordinate system (OCS).
|
64
|
+
*
|
65
|
+
* @param index Input index (0 based) of the vertex
|
66
|
+
*/
|
67
|
+
getPointAt(index: number): AcGePoint2d;
|
68
|
+
/**
|
69
|
+
* @inheritdoc
|
70
|
+
*/
|
71
|
+
calculateBoundingBox(): AcGeBox2d;
|
72
|
+
/**
|
73
|
+
* @inheritdoc
|
74
|
+
*/
|
75
|
+
transform(_matrix: AcGeMatrix2d): this;
|
76
|
+
/**
|
77
|
+
* Return an array of points to draw this polyline.
|
78
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
79
|
+
* @param elevation Input z value of points returned
|
80
|
+
* @returns Return an array of point
|
81
|
+
*/
|
82
|
+
getPoints3d(numPoints: number, elevation: number): AcGePoint3d[];
|
83
|
+
/**
|
84
|
+
* Return an array of points to draw this polyline.
|
85
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
86
|
+
* @returns Return an array of point
|
87
|
+
*/
|
88
|
+
getPoints(numPoints: number): AcGePoint2d[];
|
89
|
+
}
|
90
|
+
//# sourceMappingURL=AcGePolyline2d.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGePolyline2d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGePolyline2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,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endStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
import { AcGeBox2d, AcGePoint2d, AcGePoint3d } from '../math';
|
17
|
+
import { AcGeCircArc2d } from './AcGeCircArc2d';
|
18
|
+
import { AcGeCurve2d } from './AcGeCurve2d';
|
19
|
+
/**
|
20
|
+
* The class represents the polyline geometry.
|
21
|
+
*/
|
22
|
+
var AcGePolyline2d = /** @class */ (function (_super) {
|
23
|
+
__extends(AcGePolyline2d, _super);
|
24
|
+
function AcGePolyline2d(vertices, closed) {
|
25
|
+
if (vertices === void 0) { vertices = null; }
|
26
|
+
if (closed === void 0) { closed = false; }
|
27
|
+
var _this = _super.call(this) || this;
|
28
|
+
_this._vertices = vertices ? vertices : new Array();
|
29
|
+
_this._closed = closed;
|
30
|
+
return _this;
|
31
|
+
}
|
32
|
+
Object.defineProperty(AcGePolyline2d.prototype, "numberOfVertices", {
|
33
|
+
/**
|
34
|
+
* The number of vertices in the polyline
|
35
|
+
*/
|
36
|
+
get: function () {
|
37
|
+
return this._vertices.length;
|
38
|
+
},
|
39
|
+
enumerable: false,
|
40
|
+
configurable: true
|
41
|
+
});
|
42
|
+
Object.defineProperty(AcGePolyline2d.prototype, "closed", {
|
43
|
+
/**
|
44
|
+
* @inheritdoc
|
45
|
+
*/
|
46
|
+
get: function () {
|
47
|
+
return this._closed;
|
48
|
+
},
|
49
|
+
/**
|
50
|
+
* Set the polyline to be closed (that is, there is a segment drawn from the last vertex to the first)
|
51
|
+
* if 'value' is true. Set the polyline to be open (no segment between the last and first vertices) if
|
52
|
+
* 'value' is false.
|
53
|
+
*/
|
54
|
+
set: function (value) {
|
55
|
+
this._closed = value;
|
56
|
+
this._boundingBoxNeedsUpdate = true;
|
57
|
+
},
|
58
|
+
enumerable: false,
|
59
|
+
configurable: true
|
60
|
+
});
|
61
|
+
Object.defineProperty(AcGePolyline2d.prototype, "startPoint", {
|
62
|
+
/**
|
63
|
+
* Start point of this polyline
|
64
|
+
*/
|
65
|
+
get: function () {
|
66
|
+
if (this.numberOfVertices > 0) {
|
67
|
+
var vertex = this._vertices[0];
|
68
|
+
return new AcGePoint2d(vertex.x, vertex.y);
|
69
|
+
}
|
70
|
+
throw new Error('Start point does not exist in an empty polyline.');
|
71
|
+
},
|
72
|
+
enumerable: false,
|
73
|
+
configurable: true
|
74
|
+
});
|
75
|
+
Object.defineProperty(AcGePolyline2d.prototype, "endPoint", {
|
76
|
+
/**
|
77
|
+
* End point of this polyline
|
78
|
+
*/
|
79
|
+
get: function () {
|
80
|
+
var length = this.numberOfVertices;
|
81
|
+
if (length > 0) {
|
82
|
+
if (this.closed) {
|
83
|
+
var vertex = this._vertices[0];
|
84
|
+
return new AcGePoint2d(vertex.x, vertex.y);
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
var vertex = this._vertices[length - 1];
|
88
|
+
return new AcGePoint2d(vertex.x, vertex.y);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
throw new Error('End point does not exist in an empty polyline.');
|
92
|
+
},
|
93
|
+
enumerable: false,
|
94
|
+
configurable: true
|
95
|
+
});
|
96
|
+
Object.defineProperty(AcGePolyline2d.prototype, "length", {
|
97
|
+
/**
|
98
|
+
* @inheritdoc
|
99
|
+
*/
|
100
|
+
get: function () {
|
101
|
+
var length = 0;
|
102
|
+
var vertexArraylength = this._vertices.length;
|
103
|
+
for (var index = 0; index < vertexArraylength; ++index) {
|
104
|
+
var vertex = this._vertices[index];
|
105
|
+
var nextVertex = null;
|
106
|
+
if (index < vertexArraylength - 1) {
|
107
|
+
nextVertex = this._vertices[index + 1];
|
108
|
+
}
|
109
|
+
else if (index == vertexArraylength - 1 && this.closed) {
|
110
|
+
nextVertex = this._vertices[0];
|
111
|
+
}
|
112
|
+
if (nextVertex) {
|
113
|
+
if (vertex.bulge) {
|
114
|
+
var arc = new AcGeCircArc2d(vertex, nextVertex, vertex.bulge);
|
115
|
+
length += arc.length;
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
length += new AcGePoint2d(vertex.x, vertex.y).distanceTo(nextVertex);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return length;
|
123
|
+
},
|
124
|
+
enumerable: false,
|
125
|
+
configurable: true
|
126
|
+
});
|
127
|
+
/**
|
128
|
+
* This function adds a vertex to the polyline. If index is 0, the vertex will become the first
|
129
|
+
* vertex of the polyline. If index is the value returned by this.numberOfVertices, then the vertex
|
130
|
+
* will become the last vertex of the polyline. Otherwise the vertex will be added just before the
|
131
|
+
* index vertex.
|
132
|
+
*
|
133
|
+
* @param index Input index (0 based) before which to insert the vertex
|
134
|
+
* @param vertex Input vertex location point
|
135
|
+
*/
|
136
|
+
AcGePolyline2d.prototype.addVertexAt = function (index, vertex) {
|
137
|
+
if (index <= 0) {
|
138
|
+
this._vertices.unshift(vertex);
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
this._vertices.splice(index, 0, vertex);
|
142
|
+
}
|
143
|
+
this._boundingBoxNeedsUpdate = true;
|
144
|
+
};
|
145
|
+
/**
|
146
|
+
* Get the 2d location of the vertex index in the polyline's own object coordinate system (OCS).
|
147
|
+
*
|
148
|
+
* @param index Input index (0 based) of the vertex
|
149
|
+
*/
|
150
|
+
AcGePolyline2d.prototype.getPointAt = function (index) {
|
151
|
+
var vertex = this._vertices[index];
|
152
|
+
return new AcGePoint2d(vertex.x, vertex.y);
|
153
|
+
};
|
154
|
+
/**
|
155
|
+
* @inheritdoc
|
156
|
+
*/
|
157
|
+
AcGePolyline2d.prototype.calculateBoundingBox = function () {
|
158
|
+
var points = this.getPoints(100);
|
159
|
+
return new AcGeBox2d().setFromPoints(points);
|
160
|
+
};
|
161
|
+
/**
|
162
|
+
* @inheritdoc
|
163
|
+
*/
|
164
|
+
AcGePolyline2d.prototype.transform = function (_matrix) {
|
165
|
+
// TODO: implement it
|
166
|
+
this._boundingBoxNeedsUpdate = true;
|
167
|
+
return this;
|
168
|
+
};
|
169
|
+
/**
|
170
|
+
* Return an array of points to draw this polyline.
|
171
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
172
|
+
* @param elevation Input z value of points returned
|
173
|
+
* @returns Return an array of point
|
174
|
+
*/
|
175
|
+
AcGePolyline2d.prototype.getPoints3d = function (numPoints, elevation) {
|
176
|
+
var points = [];
|
177
|
+
var tmp = this.getPoints(numPoints);
|
178
|
+
tmp.forEach(function (point) {
|
179
|
+
return points.push(new AcGePoint3d().set(point.x, point.y, elevation));
|
180
|
+
});
|
181
|
+
return points;
|
182
|
+
};
|
183
|
+
/**
|
184
|
+
* Return an array of points to draw this polyline.
|
185
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
186
|
+
* @returns Return an array of point
|
187
|
+
*/
|
188
|
+
AcGePolyline2d.prototype.getPoints = function (numPoints) {
|
189
|
+
var points = [];
|
190
|
+
var length = this._vertices.length;
|
191
|
+
for (var index = 0; index < length; ++index) {
|
192
|
+
var vertex = this._vertices[index];
|
193
|
+
if (vertex.bulge) {
|
194
|
+
var nextVertex = null;
|
195
|
+
if (index < length - 1) {
|
196
|
+
nextVertex = this._vertices[index + 1];
|
197
|
+
}
|
198
|
+
else if (index == length - 1 && this.closed) {
|
199
|
+
nextVertex = this._vertices[0];
|
200
|
+
}
|
201
|
+
// In theory, nextVertex should be always not null
|
202
|
+
if (nextVertex) {
|
203
|
+
var arc = new AcGeCircArc2d(vertex, nextVertex, vertex.bulge);
|
204
|
+
var arcPoints = arc.getPoints(numPoints);
|
205
|
+
var length_1 = arcPoints.length;
|
206
|
+
for (var i = 0; i < length_1; ++i) {
|
207
|
+
var point = arcPoints[i];
|
208
|
+
points.push(new AcGePoint2d(point.x, point.y));
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
else {
|
213
|
+
points.push(new AcGePoint2d(vertex.x, vertex.y));
|
214
|
+
if (index == length - 1 && this.closed) {
|
215
|
+
points.push(points[0]);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return points;
|
220
|
+
};
|
221
|
+
return AcGePolyline2d;
|
222
|
+
}(AcGeCurve2d));
|
223
|
+
export { AcGePolyline2d };
|
224
|
+
//# sourceMappingURL=AcGePolyline2d.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGePolyline2d.js","sourceRoot":"","sources":["../../src/geometry/AcGePolyline2d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAgB,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAmB3C;;GAEG;AACH;IAEU,kCAAW;IAInB,wBAAY,QAAgC,EAAE,MAAuB;QAAzD,yBAAA,EAAA,eAAgC;QAAE,uBAAA,EAAA,cAAuB;QACnE,YAAA,MAAK,WAAE,SAAA;QACP,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,EAAK,CAAA;QACrD,KAAI,CAAC,OAAO,GAAG,MAAM,CAAA;;IACvB,CAAC;IAKD,sBAAI,4CAAgB;QAHpB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;QAC9B,CAAC;;;OAAA;IAKD,sBAAI,kCA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;oBACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACH,qBAAC;AAAD,CAAC,AA1LD,CAEU,WAAW,GAwLpB"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Abstract base class for all kinds of geometries.
|
3
|
+
*/
|
4
|
+
export declare abstract class AcGeShape {
|
5
|
+
protected _boundingBoxNeedsUpdate: boolean;
|
6
|
+
/**
|
7
|
+
* When this is set, it calculates the bounding box of this shape and resets this property to false.
|
8
|
+
* Default is false.
|
9
|
+
*/
|
10
|
+
get boundingBoxNeedUpdate(): boolean;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=AcGeShape.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeShape.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,8BAAsB,SAAS;IAC7B,SAAS,CAAC,uBAAuB,EAAE,OAAO,CAAQ;IAElD;;;OAGG;IACH,IAAI,qBAAqB,YAExB;CACF"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Abstract base class for all kinds of geometries.
|
3
|
+
*/
|
4
|
+
var AcGeShape = /** @class */ (function () {
|
5
|
+
function AcGeShape() {
|
6
|
+
this._boundingBoxNeedsUpdate = false;
|
7
|
+
}
|
8
|
+
Object.defineProperty(AcGeShape.prototype, "boundingBoxNeedUpdate", {
|
9
|
+
/**
|
10
|
+
* When this is set, it calculates the bounding box of this shape and resets this property to false.
|
11
|
+
* Default is false.
|
12
|
+
*/
|
13
|
+
get: function () {
|
14
|
+
return this._boundingBoxNeedsUpdate;
|
15
|
+
},
|
16
|
+
enumerable: false,
|
17
|
+
configurable: true
|
18
|
+
});
|
19
|
+
return AcGeShape;
|
20
|
+
}());
|
21
|
+
export { AcGeShape };
|
22
|
+
//# sourceMappingURL=AcGeShape.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape.js","sourceRoot":"","sources":["../../src/geometry/AcGeShape.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAAA;QACY,4BAAuB,GAAY,KAAK,CAAA;IASpD,CAAC;IAHC,sBAAI,4CAAqB;QAJzB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,uBAAuB,CAAA;QACrC,CAAC;;;OAAA;IACH,gBAAC;AAAD,CAAC,AAVD,IAUC"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { AcGeBox2d, AcGeMatrix2d, AcGeVector2dLike } from '../math';
|
2
|
+
import { AcGeShape } from './AcGeShape';
|
3
|
+
/**
|
4
|
+
* Abstract base class for all kinds of 2d shapes.
|
5
|
+
*/
|
6
|
+
export declare abstract class AcGeShape2d extends AcGeShape {
|
7
|
+
/**
|
8
|
+
* The bounding box of this shape
|
9
|
+
*/
|
10
|
+
private _box?;
|
11
|
+
/**
|
12
|
+
* Return new shape translated by given vector.
|
13
|
+
*/
|
14
|
+
translate(v: AcGeVector2dLike): this;
|
15
|
+
/**
|
16
|
+
* Transforms the entity by applying the input matrix.
|
17
|
+
* @param matrix Input transformation matrix
|
18
|
+
*/
|
19
|
+
abstract transform(matrix: AcGeMatrix2d): this;
|
20
|
+
/**
|
21
|
+
* The bounding box of this shape. Because it is a time-consuming operation to calculate the bounding
|
22
|
+
* box of one shape, the bounding box value is cached. It will be calculated again lazily once there
|
23
|
+
* are any changes to properties of this shape.
|
24
|
+
*/
|
25
|
+
get box(): AcGeBox2d;
|
26
|
+
/**
|
27
|
+
* Return true if this shape contains the specified shape
|
28
|
+
*/
|
29
|
+
protected abstract calculateBoundingBox(): AcGeBox2d;
|
30
|
+
}
|
31
|
+
//# sourceMappingURL=AcGeShape2d.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape2d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeShape2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,8BAAsB,WAAY,SAAQ,SAAS;IACjD;;OAEG;IACH,OAAO,CAAC,IAAI,CAAC,CAAW;IAExB;;OAEG;IACH,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAIpC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAE9C;;;;OAIG;IACH,IAAI,GAAG,cAMN;IAED;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,SAAS;CACrD"}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
import { AcGeMatrix2d } from '../math';
|
17
|
+
import { AcGeShape } from './AcGeShape';
|
18
|
+
/**
|
19
|
+
* Abstract base class for all kinds of 2d shapes.
|
20
|
+
*/
|
21
|
+
var AcGeShape2d = /** @class */ (function (_super) {
|
22
|
+
__extends(AcGeShape2d, _super);
|
23
|
+
function AcGeShape2d() {
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Return new shape translated by given vector.
|
28
|
+
*/
|
29
|
+
AcGeShape2d.prototype.translate = function (v) {
|
30
|
+
return this.transform(new AcGeMatrix2d().makeTranslation(v.x, v.y));
|
31
|
+
};
|
32
|
+
Object.defineProperty(AcGeShape2d.prototype, "box", {
|
33
|
+
/**
|
34
|
+
* The bounding box of this shape. Because it is a time-consuming operation to calculate the bounding
|
35
|
+
* box of one shape, the bounding box value is cached. It will be calculated again lazily once there
|
36
|
+
* are any changes to properties of this shape.
|
37
|
+
*/
|
38
|
+
get: function () {
|
39
|
+
if (this._box == null || this._boundingBoxNeedsUpdate) {
|
40
|
+
this._box = this.calculateBoundingBox();
|
41
|
+
this._boundingBoxNeedsUpdate = false;
|
42
|
+
}
|
43
|
+
return this._box;
|
44
|
+
},
|
45
|
+
enumerable: false,
|
46
|
+
configurable: true
|
47
|
+
});
|
48
|
+
return AcGeShape2d;
|
49
|
+
}(AcGeShape));
|
50
|
+
export { AcGeShape2d };
|
51
|
+
//# sourceMappingURL=AcGeShape2d.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape2d.js","sourceRoot":"","sources":["../../src/geometry/AcGeShape2d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAa,YAAY,EAAoB,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH;IAA0C,+BAAS;IAAnD;;IAoCA,CAAC;IA9BC;;OAEG;IACH,+BAAS,GAAT,UAAU,CAAmB;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,YAAY,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACrE,CAAC;IAaD,sBAAI,4BAAG;QALP;;;;WAIG;aACH;YACE,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAA;gBACvC,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAA;YACtC,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IAMH,kBAAC;AAAD,CAAC,AApCD,CAA0C,SAAS,GAoClD"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { AcGeBox3d, AcGeMatrix3d, AcGeVector3dLike } from '../math';
|
2
|
+
import { AcGeShape } from './AcGeShape';
|
3
|
+
/**
|
4
|
+
* Abstract base class for all kinds of 3d shapes.
|
5
|
+
*/
|
6
|
+
export declare abstract class AcGeShape3d extends AcGeShape {
|
7
|
+
/**
|
8
|
+
* The bounding box of this shape
|
9
|
+
*/
|
10
|
+
private _box?;
|
11
|
+
/**
|
12
|
+
* Return new shape translated by given vector.
|
13
|
+
* Translation vector may be also defined by a pair of numbers.
|
14
|
+
*/
|
15
|
+
translate(v: AcGeVector3dLike): AcGeShape3d;
|
16
|
+
/**
|
17
|
+
* Transforms the entity by applying the input matrix.
|
18
|
+
* @param matrix Input transformation matrix
|
19
|
+
* @return Return this shape
|
20
|
+
*/
|
21
|
+
abstract transform(matrix: AcGeMatrix3d): this;
|
22
|
+
/**
|
23
|
+
* The bounding box of this shape. Because it is a time-consuming operation to calculate the bounding
|
24
|
+
* box of one shape, the bounding box value is cached. It will be calculated again lazily once there
|
25
|
+
* are any changes to properties of this shape.
|
26
|
+
*/
|
27
|
+
get box(): AcGeBox3d;
|
28
|
+
/**
|
29
|
+
* Return true if this shape contains the specified shape
|
30
|
+
*/
|
31
|
+
protected abstract calculateBoundingBox(): AcGeBox3d;
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=AcGeShape3d.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeShape3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,8BAAsB,WAAY,SAAQ,SAAS;IACjD;;OAEG;IACH,OAAO,CAAC,IAAI,CAAC,CAAW;IACxB;;;OAGG;IACH,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,WAAW;IAI3C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAE9C;;;;OAIG;IACH,IAAI,GAAG,cAMN;IAED;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,SAAS;CACrD"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
import { AcGeMatrix3d } from '../math';
|
17
|
+
import { AcGeShape } from './AcGeShape';
|
18
|
+
/**
|
19
|
+
* Abstract base class for all kinds of 3d shapes.
|
20
|
+
*/
|
21
|
+
var AcGeShape3d = /** @class */ (function (_super) {
|
22
|
+
__extends(AcGeShape3d, _super);
|
23
|
+
function AcGeShape3d() {
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Return new shape translated by given vector.
|
28
|
+
* Translation vector may be also defined by a pair of numbers.
|
29
|
+
*/
|
30
|
+
AcGeShape3d.prototype.translate = function (v) {
|
31
|
+
return this.transform(new AcGeMatrix3d().makeTranslation(v.x, v.y, v.z));
|
32
|
+
};
|
33
|
+
Object.defineProperty(AcGeShape3d.prototype, "box", {
|
34
|
+
/**
|
35
|
+
* The bounding box of this shape. Because it is a time-consuming operation to calculate the bounding
|
36
|
+
* box of one shape, the bounding box value is cached. It will be calculated again lazily once there
|
37
|
+
* are any changes to properties of this shape.
|
38
|
+
*/
|
39
|
+
get: function () {
|
40
|
+
if (this._box == null || this._boundingBoxNeedsUpdate) {
|
41
|
+
this._box = this.calculateBoundingBox();
|
42
|
+
this._boundingBoxNeedsUpdate = false;
|
43
|
+
}
|
44
|
+
return this._box;
|
45
|
+
},
|
46
|
+
enumerable: false,
|
47
|
+
configurable: true
|
48
|
+
});
|
49
|
+
return AcGeShape3d;
|
50
|
+
}(AcGeShape));
|
51
|
+
export { AcGeShape3d };
|
52
|
+
//# sourceMappingURL=AcGeShape3d.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeShape3d.js","sourceRoot":"","sources":["../../src/geometry/AcGeShape3d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAa,YAAY,EAAoB,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH;IAA0C,+BAAS;IAAnD;;IAqCA,CAAC;IAhCC;;;OAGG;IACH,+BAAS,GAAT,UAAU,CAAmB;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,YAAY,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC;IAcD,sBAAI,4BAAG;QALP;;;;WAIG;aACH;YACE,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAA;gBACvC,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAA;YACtC,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IAMH,kBAAC;AAAD,CAAC,AArCD,CAA0C,SAAS,GAqClD"}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import verb from 'verb-nurbs-web';
|
2
|
+
import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d, AcGePoint3dLike, AcGePointLike } from '../math';
|
3
|
+
import { AcGeCurve3d } from './AcGeCurve3d';
|
4
|
+
export type AcGeKnotParameterizationType = 'Uniform' | 'Chord' | 'SqrtChord';
|
5
|
+
export declare class AcGeSpline3d extends AcGeCurve3d {
|
6
|
+
private _nurbsCurve;
|
7
|
+
private _fitPoints?;
|
8
|
+
private _knotParameterization?;
|
9
|
+
private _controlPoints;
|
10
|
+
private _closed;
|
11
|
+
constructor(controlPoints: AcGePointLike[], knots: number[], weights?: number[]);
|
12
|
+
constructor(fitPoints: AcGePointLike[], knotParam: AcGeKnotParameterizationType);
|
13
|
+
/**
|
14
|
+
* Degree of the spline to be created.
|
15
|
+
*/
|
16
|
+
get degree(): number;
|
17
|
+
get knotParameterization(): AcGeKnotParameterizationType | undefined;
|
18
|
+
/**
|
19
|
+
* The start point of this spline
|
20
|
+
*/
|
21
|
+
get startPoint(): AcGePoint3d;
|
22
|
+
/**
|
23
|
+
* The end point of this spline
|
24
|
+
*/
|
25
|
+
get endPoint(): AcGePoint3d;
|
26
|
+
/**
|
27
|
+
* @inheritdoc
|
28
|
+
*/
|
29
|
+
get length(): number;
|
30
|
+
/**
|
31
|
+
* Return the value of the control point at position index in the list of control points.
|
32
|
+
* If index is negative or more than the number of control points in the spline, then point
|
33
|
+
* is set to the last control point.
|
34
|
+
* @param index Input index (0 based) of point to get
|
35
|
+
* @returns
|
36
|
+
*/
|
37
|
+
getFitPointAt(index: number): AcGePoint3dLike;
|
38
|
+
/**
|
39
|
+
* Return the value of the control point at position index in the list of control points.
|
40
|
+
* If index is negative or more than the number of control points in the spline, then point
|
41
|
+
* is set to the last control point.
|
42
|
+
* @param index Input index (0 based) of point to get
|
43
|
+
* @returns
|
44
|
+
*/
|
45
|
+
getControlPointAt(index: number): import("../math").AcGeVectorLike;
|
46
|
+
/**
|
47
|
+
* Divide this spline into the specified nubmer of points
|
48
|
+
* those points as an array of points.
|
49
|
+
* @param numPoints Input the nubmer of points returned
|
50
|
+
* @returns Return an array of point
|
51
|
+
*/
|
52
|
+
getPoints(numPoints?: number): AcGePoint3d[];
|
53
|
+
getCurvePoints(curve: verb.geom.NurbsCurve, count: number): verb.core.Data.Point[];
|
54
|
+
/**
|
55
|
+
* @inheritdoc
|
56
|
+
*/
|
57
|
+
calculateBoundingBox(): AcGeBox3d;
|
58
|
+
get closed(): boolean;
|
59
|
+
set closed(value: boolean);
|
60
|
+
/**
|
61
|
+
* @inheritdoc
|
62
|
+
*/
|
63
|
+
transform(_matrix: AcGeMatrix3d): this;
|
64
|
+
/**
|
65
|
+
* Convert input points to points in verb-nurbs-web format
|
66
|
+
* @param points Input points to convert
|
67
|
+
* @returns Return converted points
|
68
|
+
*/
|
69
|
+
private toVerbPoints;
|
70
|
+
/**
|
71
|
+
* Convert input points to points in geometry engine format
|
72
|
+
* @param points Input points to convert
|
73
|
+
* @returns Return converted points
|
74
|
+
*/
|
75
|
+
private toGePoints;
|
76
|
+
}
|
77
|
+
//# sourceMappingURL=AcGeSpline3d.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeSpline3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d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