@mlightcad/geometry-engine 3.0.4 → 3.0.6
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/geometry-engine.js +10702 -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/AcGeCatmullRomCurve3d.d.ts +146 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.js +358 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.js.map +1 -0
- package/lib/geometry/AcGeCircArc2d.d.ts +132 -0
- package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -0
- package/lib/geometry/AcGeCircArc2d.js +473 -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 +142 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -0
- package/lib/geometry/AcGeEllipseArc3d.js +459 -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/AcGeNurbsCurve.d.ts +73 -0
- package/lib/geometry/AcGeNurbsCurve.d.ts.map +1 -0
- package/lib/geometry/AcGeNurbsCurve.js +172 -0
- package/lib/geometry/AcGeNurbsCurve.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 +99 -0
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -0
- package/lib/geometry/AcGeSpline3d.js +350 -0
- package/lib/geometry/AcGeSpline3d.js.map +1 -0
- package/lib/geometry/index.d.ts +15 -0
- package/lib/geometry/index.d.ts.map +1 -0
- package/lib/geometry/index.js +15 -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/AcGeNurbsUtil.d.ts +34 -0
- package/lib/util/AcGeNurbsUtil.d.ts.map +1 -0
- package/lib/util/AcGeNurbsUtil.js +218 -0
- package/lib/util/AcGeNurbsUtil.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 +6 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +6 -0
- package/lib/util/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d } from '../math';
|
|
2
|
+
import { AcGeLoop2d } from './AcGeLoop2d';
|
|
3
|
+
import { AcGePolyline2d } from './AcGePolyline2d';
|
|
4
|
+
import { AcGeShape2d } from './AcGeShape2d';
|
|
5
|
+
export interface AcGeIndexNode {
|
|
6
|
+
index: number;
|
|
7
|
+
children: AcGeIndexNode[];
|
|
8
|
+
}
|
|
9
|
+
export type AcGeLoop2dType = AcGeLoop2d | AcGePolyline2d;
|
|
10
|
+
/**
|
|
11
|
+
* 2d area defined by one outter loop and multiple inner loops
|
|
12
|
+
*/
|
|
13
|
+
export declare class AcGeArea2d extends AcGeShape2d {
|
|
14
|
+
private _loops;
|
|
15
|
+
/**
|
|
16
|
+
* Create one 2d area defined by one outter loop and multiple inner loops
|
|
17
|
+
*/
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Append one loop to loops of this area. If it is the first loop added, it is the outter loop.
|
|
21
|
+
* Otherwise, it is an inner loop.
|
|
22
|
+
* @param loop Input the loop to append
|
|
23
|
+
*/
|
|
24
|
+
add(loop: AcGeLoop2dType): void;
|
|
25
|
+
/**
|
|
26
|
+
* The loops of this area
|
|
27
|
+
*/
|
|
28
|
+
get loops(): ReadonlyArray<AcGeLoop2dType>;
|
|
29
|
+
/**
|
|
30
|
+
* Outter loop of this area
|
|
31
|
+
*/
|
|
32
|
+
get outter(): AcGeLoop2dType | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritdoc
|
|
35
|
+
*/
|
|
36
|
+
calculateBoundingBox(): AcGeBox2d;
|
|
37
|
+
/**
|
|
38
|
+
* @inheritdoc
|
|
39
|
+
*/
|
|
40
|
+
transform(_matrix: AcGeMatrix2d): this;
|
|
41
|
+
/**
|
|
42
|
+
* Return boundary points of this area
|
|
43
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
|
44
|
+
* @returns Return points
|
|
45
|
+
*/
|
|
46
|
+
getPoints(numPoints: number): AcGePoint2d[][];
|
|
47
|
+
buildHierarchy(): AcGeIndexNode;
|
|
48
|
+
/**
|
|
49
|
+
* Calcuate bounding box of each loop in this area and return an array of their bounding box
|
|
50
|
+
* @param pointBoundaries An array of loop consisted by points
|
|
51
|
+
* @returns Return an array of bounding box
|
|
52
|
+
*/
|
|
53
|
+
private calculateBoundaryBoxes;
|
|
54
|
+
/**
|
|
55
|
+
* Sort boundary boxes by its area and return the index of boundary boxes array
|
|
56
|
+
* @param boundaryBoxes An array of boundary bounding box
|
|
57
|
+
* @returns Return an index array of boundary bounding box sorted by its area
|
|
58
|
+
*/
|
|
59
|
+
private sortBoundaryBoxesByAreas;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=AcGeArea2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcGeArea2d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeArea2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAA;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,cAAc,CAAA;AAExD;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAW;IACzC,OAAO,CAAC,MAAM,CAAuB;IAErC;;OAEG;;IAMH;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,cAAc;IAKxB;;OAEG;IACH,IAAI,KAAK,IACe,aAAa,CAAC,cAAc,CAAC,CACpD;IAED;;OAEG;IACH,IAAI,MAAM,+BAKT;IAED;;OAEG;IACH,oBAAoB,IAAI,SAAS;IASjC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,YAAY;IAM/B;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,EAAE;IAU7C,cAAc;IA8Cd;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAQ9B;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;CAmBjC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
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 { AcGeBox2d } from '../math';
|
|
17
|
+
import { AcGeGeometryUtil, AcGeMathUtil } from '../util';
|
|
18
|
+
import { AcGeShape2d } from './AcGeShape2d';
|
|
19
|
+
/**
|
|
20
|
+
* 2d area defined by one outter loop and multiple inner loops
|
|
21
|
+
*/
|
|
22
|
+
var AcGeArea2d = /** @class */ (function (_super) {
|
|
23
|
+
__extends(AcGeArea2d, _super);
|
|
24
|
+
/**
|
|
25
|
+
* Create one 2d area defined by one outter loop and multiple inner loops
|
|
26
|
+
*/
|
|
27
|
+
function AcGeArea2d() {
|
|
28
|
+
var _this = _super.call(this) || this;
|
|
29
|
+
_this._loops = [];
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Append one loop to loops of this area. If it is the first loop added, it is the outter loop.
|
|
34
|
+
* Otherwise, it is an inner loop.
|
|
35
|
+
* @param loop Input the loop to append
|
|
36
|
+
*/
|
|
37
|
+
AcGeArea2d.prototype.add = function (loop) {
|
|
38
|
+
this._loops.push(loop);
|
|
39
|
+
this._boundingBoxNeedsUpdate = true;
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(AcGeArea2d.prototype, "loops", {
|
|
42
|
+
/**
|
|
43
|
+
* The loops of this area
|
|
44
|
+
*/
|
|
45
|
+
get: function () {
|
|
46
|
+
return this._loops;
|
|
47
|
+
},
|
|
48
|
+
enumerable: false,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(AcGeArea2d.prototype, "outter", {
|
|
52
|
+
/**
|
|
53
|
+
* Outter loop of this area
|
|
54
|
+
*/
|
|
55
|
+
get: function () {
|
|
56
|
+
if (this._loops.length > 0) {
|
|
57
|
+
return this._loops[0];
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
},
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* @inheritdoc
|
|
66
|
+
*/
|
|
67
|
+
AcGeArea2d.prototype.calculateBoundingBox = function () {
|
|
68
|
+
var outterLoop = this.outter;
|
|
69
|
+
if (outterLoop) {
|
|
70
|
+
return outterLoop.box;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return new AcGeBox2d();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @inheritdoc
|
|
78
|
+
*/
|
|
79
|
+
AcGeArea2d.prototype.transform = function (_matrix) {
|
|
80
|
+
// TODO: implement it
|
|
81
|
+
this._boundingBoxNeedsUpdate = true;
|
|
82
|
+
return this;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Return boundary points of this area
|
|
86
|
+
* @param numPoints Input the nubmer of points returned for arc segmentation
|
|
87
|
+
* @returns Return points
|
|
88
|
+
*/
|
|
89
|
+
AcGeArea2d.prototype.getPoints = function (numPoints) {
|
|
90
|
+
var pointBoundaries = [];
|
|
91
|
+
for (var index = 0; index < this.loops.length; ++index) {
|
|
92
|
+
var loop = this.loops[index];
|
|
93
|
+
var points = loop.getPoints(numPoints);
|
|
94
|
+
pointBoundaries.push(points);
|
|
95
|
+
}
|
|
96
|
+
return pointBoundaries;
|
|
97
|
+
};
|
|
98
|
+
AcGeArea2d.prototype.buildHierarchy = function () {
|
|
99
|
+
var _a;
|
|
100
|
+
var pointBoundaries = this.getPoints(100);
|
|
101
|
+
var boundaryBoxes = this.calculateBoundaryBoxes(pointBoundaries);
|
|
102
|
+
var areaSortIndex = this.sortBoundaryBoxesByAreas(boundaryBoxes);
|
|
103
|
+
var indexNodeMap = new Map(); // index => IndexNode
|
|
104
|
+
var count = areaSortIndex.length;
|
|
105
|
+
for (var i = 0; i < count; i++) {
|
|
106
|
+
indexNodeMap.set(areaSortIndex[i], {
|
|
107
|
+
index: areaSortIndex[i],
|
|
108
|
+
children: []
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
var rootNode = { index: -1, children: [] };
|
|
112
|
+
for (var i = 0; i < count; i++) {
|
|
113
|
+
var index = areaSortIndex[i];
|
|
114
|
+
var boundary = pointBoundaries[index];
|
|
115
|
+
var box = boundaryBoxes[index];
|
|
116
|
+
var j = i + 1;
|
|
117
|
+
for (; j < count; j++) {
|
|
118
|
+
var index2 = areaSortIndex[j];
|
|
119
|
+
var boundary2 = pointBoundaries[index2];
|
|
120
|
+
var box2 = boundaryBoxes[index2];
|
|
121
|
+
// Determine whether the boundary is within the boundary2
|
|
122
|
+
if (box2.containsBox(box) &&
|
|
123
|
+
AcGeGeometryUtil.isPointInPolygon(boundary[AcGeMathUtil.randInt(0, boundary.length - 1)], boundary2)) {
|
|
124
|
+
(_a = indexNodeMap
|
|
125
|
+
.get(index2)) === null || _a === void 0 ? void 0 : _a.children.push(indexNodeMap.get(index));
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (j === count) {
|
|
130
|
+
rootNode.children.push(indexNodeMap.get(index));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return rootNode;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Calcuate bounding box of each loop in this area and return an array of their bounding box
|
|
137
|
+
* @param pointBoundaries An array of loop consisted by points
|
|
138
|
+
* @returns Return an array of bounding box
|
|
139
|
+
*/
|
|
140
|
+
AcGeArea2d.prototype.calculateBoundaryBoxes = function (pointBoundaries) {
|
|
141
|
+
var boundaryBoxes = [];
|
|
142
|
+
pointBoundaries.forEach(function (points) {
|
|
143
|
+
boundaryBoxes.push(new AcGeBox2d().setFromPoints(points));
|
|
144
|
+
});
|
|
145
|
+
return boundaryBoxes;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Sort boundary boxes by its area and return the index of boundary boxes array
|
|
149
|
+
* @param boundaryBoxes An array of boundary bounding box
|
|
150
|
+
* @returns Return an index array of boundary bounding box sorted by its area
|
|
151
|
+
*/
|
|
152
|
+
AcGeArea2d.prototype.sortBoundaryBoxesByAreas = function (boundaryBoxes) {
|
|
153
|
+
var boundaryAreas = [];
|
|
154
|
+
boundaryBoxes.forEach(function (box, index) {
|
|
155
|
+
var size = box.size;
|
|
156
|
+
var area = size.width * size.height;
|
|
157
|
+
boundaryAreas.push({
|
|
158
|
+
area: area,
|
|
159
|
+
index: index
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
boundaryAreas.sort(function (a, b) {
|
|
163
|
+
return a.area - b.area;
|
|
164
|
+
});
|
|
165
|
+
var indices = [];
|
|
166
|
+
boundaryAreas.forEach(function (a) {
|
|
167
|
+
indices.push(a.index);
|
|
168
|
+
});
|
|
169
|
+
return indices;
|
|
170
|
+
};
|
|
171
|
+
return AcGeArea2d;
|
|
172
|
+
}(AcGeShape2d));
|
|
173
|
+
export { AcGeArea2d };
|
|
174
|
+
//# sourceMappingURL=AcGeArea2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcGeArea2d.js","sourceRoot":"","sources":["../../src/geometry/AcGeArea2d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAA8C,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAS3C;;GAEG;AACH;IAAgC,8BAAW;IAGzC;;OAEG;IACH;QACE,YAAA,MAAK,WAAE,SAAA;QACP,KAAI,CAAC,MAAM,GAAG,EAAE,CAAA;;IAClB,CAAC;IAED;;;;OAIG;IACH,wBAAG,GAAH,UAAI,IAAoB;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtB,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAA;IACrC,CAAC;IAKD,sBAAI,6BAAK;QAHT;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,MAAuC,CAAA;QACrD,CAAC;;;OAAA;IAKD,sBAAI,8BA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C,KAAK,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC;IACH,iBAAC;AAAD,CAAC,AA7JD,CAAgC,WAAW,GA6J1C"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d, AcGePoint3dLike } from '../math';
|
|
2
|
+
import { AcGeCurve3d } from './AcGeCurve3d';
|
|
3
|
+
/**
|
|
4
|
+
* Centripetal CatmullRom Curve - which is useful for avoiding
|
|
5
|
+
* cusps and self-intersections in non-uniform catmull rom curves.
|
|
6
|
+
* http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
|
|
7
|
+
*
|
|
8
|
+
* curve.type accepts centripetal(default), chordal and catmullrom
|
|
9
|
+
* curve.tension is used for catmullrom which defaults to 0.5
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Type for curve interpolation methods
|
|
13
|
+
*/
|
|
14
|
+
export type CatmullRomCurveType = 'centripetal' | 'chordal' | 'catmullrom';
|
|
15
|
+
/**
|
|
16
|
+
* A curve representing a Catmull-Rom spline.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* //Create a closed wavey loop
|
|
20
|
+
* const curve = new AcGeCatmullRomCurve3d( [
|
|
21
|
+
* new AcGePoint3d( -10, 0, 10 ),
|
|
22
|
+
* new AcGePoint3d( -5, 5, 5 ),
|
|
23
|
+
* new AcGePoint3d( 0, 0, 0 ),
|
|
24
|
+
* new AcGePoint3d( 5, -5, 5 ),
|
|
25
|
+
* new AcGePoint3d( 10, 0, 10 )
|
|
26
|
+
* ], true ); // true for closed curve
|
|
27
|
+
*
|
|
28
|
+
* const points = curve.getPoints( 50 );
|
|
29
|
+
*
|
|
30
|
+
* // Convert to NURBS curve
|
|
31
|
+
* const nurbsCurve = curve.toNurbsCurve();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class AcGeCatmullRomCurve3d extends AcGeCurve3d {
|
|
35
|
+
/**
|
|
36
|
+
* This flag can be used for type testing.
|
|
37
|
+
*/
|
|
38
|
+
readonly isCatmullRomCurve3d = true;
|
|
39
|
+
/**
|
|
40
|
+
* The curve type identifier
|
|
41
|
+
*/
|
|
42
|
+
readonly type = "CatmullRomCurve3d";
|
|
43
|
+
/**
|
|
44
|
+
* An array of 3D points defining the curve.
|
|
45
|
+
*/
|
|
46
|
+
private _points;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the curve is closed or not.
|
|
49
|
+
*/
|
|
50
|
+
private _closed;
|
|
51
|
+
/**
|
|
52
|
+
* The curve type.
|
|
53
|
+
*/
|
|
54
|
+
private _curveType;
|
|
55
|
+
/**
|
|
56
|
+
* Tension of the curve.
|
|
57
|
+
*/
|
|
58
|
+
private _tension;
|
|
59
|
+
private readonly _tmp;
|
|
60
|
+
private readonly _px;
|
|
61
|
+
private readonly _py;
|
|
62
|
+
private readonly _pz;
|
|
63
|
+
/**
|
|
64
|
+
* Constructs a new Catmull-Rom curve.
|
|
65
|
+
*
|
|
66
|
+
* @param points - An array of 3D points defining the curve.
|
|
67
|
+
* @param closed - Whether the curve is closed or not.
|
|
68
|
+
* @param curveType - The curve type.
|
|
69
|
+
* @param tension - Tension of the curve.
|
|
70
|
+
*/
|
|
71
|
+
constructor(points?: AcGePoint3dLike[], closed?: boolean, curveType?: CatmullRomCurveType, tension?: number);
|
|
72
|
+
/**
|
|
73
|
+
* An array of 3D points defining the curve.
|
|
74
|
+
*/
|
|
75
|
+
get points(): AcGePoint3d[];
|
|
76
|
+
/**
|
|
77
|
+
* Whether the curve is closed or not.
|
|
78
|
+
*/
|
|
79
|
+
get closed(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The curve type.
|
|
82
|
+
*/
|
|
83
|
+
get curveType(): CatmullRomCurveType;
|
|
84
|
+
/**
|
|
85
|
+
* Tension of the curve.
|
|
86
|
+
*/
|
|
87
|
+
get tension(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Start point of this curve.
|
|
90
|
+
*/
|
|
91
|
+
get startPoint(): AcGePoint3d;
|
|
92
|
+
/**
|
|
93
|
+
* End point of this curve.
|
|
94
|
+
*/
|
|
95
|
+
get endPoint(): AcGePoint3d;
|
|
96
|
+
/**
|
|
97
|
+
* Length of this curve (approximated).
|
|
98
|
+
*/
|
|
99
|
+
get length(): number;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a point on the curve.
|
|
102
|
+
*
|
|
103
|
+
* @param t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
|
|
104
|
+
* @param optionalTarget - The optional target vector the result is written to.
|
|
105
|
+
* @return The position on the curve.
|
|
106
|
+
*/
|
|
107
|
+
getPoint(t: number, optionalTarget?: AcGePoint3d): AcGePoint3d;
|
|
108
|
+
/**
|
|
109
|
+
* Get an array of points along the curve
|
|
110
|
+
* @param divisions - Number of divisions to create
|
|
111
|
+
* @returns Array of points along the curve
|
|
112
|
+
*/
|
|
113
|
+
getPoints(divisions: number): AcGePoint3d[];
|
|
114
|
+
/**
|
|
115
|
+
* Set the points defining the curve
|
|
116
|
+
* @param points - Array of points
|
|
117
|
+
*/
|
|
118
|
+
setPoints(points: AcGePoint3dLike[]): void;
|
|
119
|
+
/**
|
|
120
|
+
* Set whether the curve is closed
|
|
121
|
+
* @param closed - Whether the curve should be closed
|
|
122
|
+
*/
|
|
123
|
+
setClosed(closed: boolean): void;
|
|
124
|
+
/**
|
|
125
|
+
* Set the curve type
|
|
126
|
+
* @param curveType - The curve type
|
|
127
|
+
*/
|
|
128
|
+
setCurveType(curveType: CatmullRomCurveType): void;
|
|
129
|
+
/**
|
|
130
|
+
* Set the tension of the curve
|
|
131
|
+
* @param tension - The tension value
|
|
132
|
+
*/
|
|
133
|
+
setTension(tension: number): void;
|
|
134
|
+
/**
|
|
135
|
+
* Transforms the curve by applying the input matrix.
|
|
136
|
+
* @param matrix Input transformation matrix
|
|
137
|
+
* @return Return this curve
|
|
138
|
+
*/
|
|
139
|
+
transform(matrix: AcGeMatrix3d): this;
|
|
140
|
+
/**
|
|
141
|
+
* Calculate the bounding box of this curve.
|
|
142
|
+
* @return The bounding box
|
|
143
|
+
*/
|
|
144
|
+
protected calculateBoundingBox(): AcGeBox3d;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=AcGeCatmullRomCurve3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcGeCatmullRomCurve3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeCatmullRomCurve3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EAEhB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAA;AA2E1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IACpD;;OAEG;IACH,QAAQ,CAAC,mBAAmB,QAAO;IAEnC;;OAEG;IACH,QAAQ,CAAC,IAAI,uBAAsB;IAEnC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAe;IAE9B;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;OAEG;IACH,OAAO,CAAC,UAAU,CAAqB;IAEvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAQ;IAGxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IAEtC;;;;;;;OAOG;gBAED,MAAM,GAAE,eAAe,EAAO,EAC9B,MAAM,UAAQ,EACd,SAAS,GAAE,mBAAmC,EAC9C,OAAO,SAAM;IASf;;OAEG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