@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.
Files changed (149) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/geometry-engine.js +10186 -0
  4. package/dist/geometry-engine.umd.cjs +4 -0
  5. package/lib/geometry/AcGeArea2d.d.ts +61 -0
  6. package/lib/geometry/AcGeArea2d.d.ts.map +1 -0
  7. package/lib/geometry/AcGeArea2d.js +174 -0
  8. package/lib/geometry/AcGeArea2d.js.map +1 -0
  9. package/lib/geometry/AcGeCircArc2d.d.ts +108 -0
  10. package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -0
  11. package/lib/geometry/AcGeCircArc2d.js +412 -0
  12. package/lib/geometry/AcGeCircArc2d.js.map +1 -0
  13. package/lib/geometry/AcGeCircArc3d.d.ts +138 -0
  14. package/lib/geometry/AcGeCircArc3d.d.ts.map +1 -0
  15. package/lib/geometry/AcGeCircArc3d.js +447 -0
  16. package/lib/geometry/AcGeCircArc3d.js.map +1 -0
  17. package/lib/geometry/AcGeCurve2d.d.ts +85 -0
  18. package/lib/geometry/AcGeCurve2d.d.ts.map +1 -0
  19. package/lib/geometry/AcGeCurve2d.js +213 -0
  20. package/lib/geometry/AcGeCurve2d.js.map +1 -0
  21. package/lib/geometry/AcGeCurve3d.d.ts +27 -0
  22. package/lib/geometry/AcGeCurve3d.d.ts.map +1 -0
  23. package/lib/geometry/AcGeCurve3d.js +29 -0
  24. package/lib/geometry/AcGeCurve3d.js.map +1 -0
  25. package/lib/geometry/AcGeEllipseArc2d.d.ts +105 -0
  26. package/lib/geometry/AcGeEllipseArc2d.d.ts.map +1 -0
  27. package/lib/geometry/AcGeEllipseArc2d.js +292 -0
  28. package/lib/geometry/AcGeEllipseArc2d.js.map +1 -0
  29. package/lib/geometry/AcGeEllipseArc3d.d.ts +141 -0
  30. package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -0
  31. package/lib/geometry/AcGeEllipseArc3d.js +442 -0
  32. package/lib/geometry/AcGeEllipseArc3d.js.map +1 -0
  33. package/lib/geometry/AcGeLine2d.d.ts +56 -0
  34. package/lib/geometry/AcGeLine2d.d.ts.map +1 -0
  35. package/lib/geometry/AcGeLine2d.js +125 -0
  36. package/lib/geometry/AcGeLine2d.js.map +1 -0
  37. package/lib/geometry/AcGeLine3d.d.ts +134 -0
  38. package/lib/geometry/AcGeLine3d.d.ts.map +1 -0
  39. package/lib/geometry/AcGeLine3d.js +291 -0
  40. package/lib/geometry/AcGeLine3d.js.map +1 -0
  41. package/lib/geometry/AcGeLoop2d.d.ts +59 -0
  42. package/lib/geometry/AcGeLoop2d.d.ts.map +1 -0
  43. package/lib/geometry/AcGeLoop2d.js +141 -0
  44. package/lib/geometry/AcGeLoop2d.js.map +1 -0
  45. package/lib/geometry/AcGePolyline2d.d.ts +90 -0
  46. package/lib/geometry/AcGePolyline2d.d.ts.map +1 -0
  47. package/lib/geometry/AcGePolyline2d.js +224 -0
  48. package/lib/geometry/AcGePolyline2d.js.map +1 -0
  49. package/lib/geometry/AcGeShape.d.ts +12 -0
  50. package/lib/geometry/AcGeShape.d.ts.map +1 -0
  51. package/lib/geometry/AcGeShape.js +22 -0
  52. package/lib/geometry/AcGeShape.js.map +1 -0
  53. package/lib/geometry/AcGeShape2d.d.ts +31 -0
  54. package/lib/geometry/AcGeShape2d.d.ts.map +1 -0
  55. package/lib/geometry/AcGeShape2d.js +51 -0
  56. package/lib/geometry/AcGeShape2d.js.map +1 -0
  57. package/lib/geometry/AcGeShape3d.d.ts +33 -0
  58. package/lib/geometry/AcGeShape3d.d.ts.map +1 -0
  59. package/lib/geometry/AcGeShape3d.js +52 -0
  60. package/lib/geometry/AcGeShape3d.js.map +1 -0
  61. package/lib/geometry/AcGeSpline3d.d.ts +77 -0
  62. package/lib/geometry/AcGeSpline3d.d.ts.map +1 -0
  63. package/lib/geometry/AcGeSpline3d.js +221 -0
  64. package/lib/geometry/AcGeSpline3d.js.map +1 -0
  65. package/lib/geometry/index.d.ts +13 -0
  66. package/lib/geometry/index.d.ts.map +1 -0
  67. package/lib/geometry/index.js +13 -0
  68. package/lib/geometry/index.js.map +1 -0
  69. package/lib/index.d.ts +4 -0
  70. package/lib/index.d.ts.map +1 -0
  71. package/lib/index.js +4 -0
  72. package/lib/index.js.map +1 -0
  73. package/lib/math/AcGeBox2d.d.ts +173 -0
  74. package/lib/math/AcGeBox2d.d.ts.map +1 -0
  75. package/lib/math/AcGeBox2d.js +289 -0
  76. package/lib/math/AcGeBox2d.js.map +1 -0
  77. package/lib/math/AcGeBox3d.d.ts +195 -0
  78. package/lib/math/AcGeBox3d.d.ts.map +1 -0
  79. package/lib/math/AcGeBox3d.js +378 -0
  80. package/lib/math/AcGeBox3d.js.map +1 -0
  81. package/lib/math/AcGeEuler.d.ts +133 -0
  82. package/lib/math/AcGeEuler.d.ts.map +1 -0
  83. package/lib/math/AcGeEuler.js +358 -0
  84. package/lib/math/AcGeEuler.js.map +1 -0
  85. package/lib/math/AcGeMatrix2d.d.ts +203 -0
  86. package/lib/math/AcGeMatrix2d.d.ts.map +1 -0
  87. package/lib/math/AcGeMatrix2d.js +393 -0
  88. package/lib/math/AcGeMatrix2d.js.map +1 -0
  89. package/lib/math/AcGeMatrix3d.d.ts +279 -0
  90. package/lib/math/AcGeMatrix3d.d.ts.map +1 -0
  91. package/lib/math/AcGeMatrix3d.js +1037 -0
  92. package/lib/math/AcGeMatrix3d.js.map +1 -0
  93. package/lib/math/AcGePlane.d.ts +131 -0
  94. package/lib/math/AcGePlane.d.ts.map +1 -0
  95. package/lib/math/AcGePlane.js +218 -0
  96. package/lib/math/AcGePlane.js.map +1 -0
  97. package/lib/math/AcGePoint.d.ts +4 -0
  98. package/lib/math/AcGePoint.d.ts.map +1 -0
  99. package/lib/math/AcGePoint.js +2 -0
  100. package/lib/math/AcGePoint.js.map +1 -0
  101. package/lib/math/AcGePoint2d.d.ts +17 -0
  102. package/lib/math/AcGePoint2d.d.ts.map +1 -0
  103. package/lib/math/AcGePoint2d.js +40 -0
  104. package/lib/math/AcGePoint2d.js.map +1 -0
  105. package/lib/math/AcGePoint3d.d.ts +18 -0
  106. package/lib/math/AcGePoint3d.d.ts.map +1 -0
  107. package/lib/math/AcGePoint3d.js +43 -0
  108. package/lib/math/AcGePoint3d.js.map +1 -0
  109. package/lib/math/AcGeQuaternion.d.ts +230 -0
  110. package/lib/math/AcGeQuaternion.d.ts.map +1 -0
  111. package/lib/math/AcGeQuaternion.js +666 -0
  112. package/lib/math/AcGeQuaternion.js.map +1 -0
  113. package/lib/math/AcGeVector.d.ts +9 -0
  114. package/lib/math/AcGeVector.d.ts.map +1 -0
  115. package/lib/math/AcGeVector.js +2 -0
  116. package/lib/math/AcGeVector.js.map +1 -0
  117. package/lib/math/AcGeVector2d.d.ts +361 -0
  118. package/lib/math/AcGeVector2d.d.ts.map +1 -0
  119. package/lib/math/AcGeVector2d.js +622 -0
  120. package/lib/math/AcGeVector2d.js.map +1 -0
  121. package/lib/math/AcGeVector3d.d.ts +493 -0
  122. package/lib/math/AcGeVector3d.d.ts.map +1 -0
  123. package/lib/math/AcGeVector3d.js +868 -0
  124. package/lib/math/AcGeVector3d.js.map +1 -0
  125. package/lib/math/index.d.ts +14 -0
  126. package/lib/math/index.d.ts.map +1 -0
  127. package/lib/math/index.js +14 -0
  128. package/lib/math/index.js.map +1 -0
  129. package/lib/util/AcGeConstants.d.ts +19 -0
  130. package/lib/util/AcGeConstants.d.ts.map +1 -0
  131. package/lib/util/AcGeConstants.js +25 -0
  132. package/lib/util/AcGeConstants.js.map +1 -0
  133. package/lib/util/AcGeGeometryUtil.d.ts +16 -0
  134. package/lib/util/AcGeGeometryUtil.d.ts.map +1 -0
  135. package/lib/util/AcGeGeometryUtil.js +56 -0
  136. package/lib/util/AcGeGeometryUtil.js.map +1 -0
  137. package/lib/util/AcGeMathUtil.d.ts +203 -0
  138. package/lib/util/AcGeMathUtil.d.ts.map +1 -0
  139. package/lib/util/AcGeMathUtil.js +585 -0
  140. package/lib/util/AcGeMathUtil.js.map +1 -0
  141. package/lib/util/AcGeTol.d.ts +91 -0
  142. package/lib/util/AcGeTol.d.ts.map +1 -0
  143. package/lib/util/AcGeTol.js +83 -0
  144. package/lib/util/AcGeTol.js.map +1 -0
  145. package/lib/util/index.d.ts +5 -0
  146. package/lib/util/index.d.ts.map +1 -0
  147. package/lib/util/index.js +5 -0
  148. package/lib/util/index.js.map +1 -0
  149. package/package.json +42 -0
@@ -0,0 +1,221 @@
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 { AcCmErrors } from '@mlightcad/common';
17
+ import verb from 'verb-nurbs-web';
18
+ import { AcGeBox3d, AcGePoint3d } from '../math';
19
+ import { AcGeCurve3d } from './AcGeCurve3d';
20
+ var AcGeSpline3d = /** @class */ (function (_super) {
21
+ __extends(AcGeSpline3d, _super);
22
+ function AcGeSpline3d(a, b, c) {
23
+ var _this = _super.call(this) || this;
24
+ var argsLength = +(a !== undefined) + +(b !== undefined) + +(c !== undefined);
25
+ if (argsLength != 2 && argsLength != 3) {
26
+ throw AcCmErrors.ILLEGAL_PARAMETERS;
27
+ }
28
+ // For now, we support 3 degree only
29
+ var degree = 3;
30
+ _this._closed = false;
31
+ if (argsLength == 2 && !Array.isArray(b)) {
32
+ _this._fitPoints = a;
33
+ _this._knotParameterization = b;
34
+ var points = _this.toVerbPoints(_this._fitPoints);
35
+ _this._nurbsCurve = verb.geom.NurbsCurve.byPoints(points, degree);
36
+ _this._controlPoints = _this.toGePoints(_this._nurbsCurve.controlPoints());
37
+ }
38
+ else {
39
+ _this._controlPoints = a;
40
+ var points = _this.toVerbPoints(_this._controlPoints);
41
+ _this._nurbsCurve = verb.geom.NurbsCurve.byKnotsControlPointsWeights(degree, b, points, c);
42
+ }
43
+ return _this;
44
+ }
45
+ Object.defineProperty(AcGeSpline3d.prototype, "degree", {
46
+ /**
47
+ * Degree of the spline to be created.
48
+ */
49
+ get: function () {
50
+ return this._nurbsCurve.degree();
51
+ },
52
+ enumerable: false,
53
+ configurable: true
54
+ });
55
+ Object.defineProperty(AcGeSpline3d.prototype, "knotParameterization", {
56
+ get: function () {
57
+ return this._knotParameterization;
58
+ },
59
+ enumerable: false,
60
+ configurable: true
61
+ });
62
+ Object.defineProperty(AcGeSpline3d.prototype, "startPoint", {
63
+ /**
64
+ * The start point of this spline
65
+ */
66
+ get: function () {
67
+ var knots = this._nurbsCurve.knots();
68
+ var degree = this._nurbsCurve.degree();
69
+ var startParam = knots[degree];
70
+ var startPoint = this._nurbsCurve.point(startParam);
71
+ return new AcGePoint3d(startPoint[0], startPoint[1], startPoint[2]);
72
+ },
73
+ enumerable: false,
74
+ configurable: true
75
+ });
76
+ Object.defineProperty(AcGeSpline3d.prototype, "endPoint", {
77
+ /**
78
+ * The end point of this spline
79
+ */
80
+ get: function () {
81
+ var knots = this._nurbsCurve.knots();
82
+ var degree = this._nurbsCurve.degree();
83
+ var endParam = knots[knots.length - degree - 1];
84
+ var endPoint = this._nurbsCurve.point(endParam);
85
+ return new AcGePoint3d(endPoint[0], endPoint[1], endPoint[2]);
86
+ },
87
+ enumerable: false,
88
+ configurable: true
89
+ });
90
+ Object.defineProperty(AcGeSpline3d.prototype, "length", {
91
+ /**
92
+ * @inheritdoc
93
+ */
94
+ get: function () {
95
+ return this._nurbsCurve.length();
96
+ },
97
+ enumerable: false,
98
+ configurable: true
99
+ });
100
+ /**
101
+ * Return the value of the control point at position index in the list of control points.
102
+ * If index is negative or more than the number of control points in the spline, then point
103
+ * is set to the last control point.
104
+ * @param index Input index (0 based) of point to get
105
+ * @returns
106
+ */
107
+ AcGeSpline3d.prototype.getFitPointAt = function (index) {
108
+ if (!this._fitPoints) {
109
+ throw new Error('No fit points in this spline');
110
+ }
111
+ var length = this._fitPoints.length;
112
+ var newIndex = index < 0 || index >= length ? length - 1 : index;
113
+ var point = this._fitPoints[newIndex];
114
+ return { x: point.x, y: point.y, z: point.z || 0 };
115
+ };
116
+ /**
117
+ * Return the value of the control point at position index in the list of control points.
118
+ * If index is negative or more than the number of control points in the spline, then point
119
+ * is set to the last control point.
120
+ * @param index Input index (0 based) of point to get
121
+ * @returns
122
+ */
123
+ AcGeSpline3d.prototype.getControlPointAt = function (index) {
124
+ var length = this._controlPoints.length;
125
+ var newIndex = index < 0 || index >= length ? length - 1 : index;
126
+ return this._controlPoints[newIndex];
127
+ };
128
+ /**
129
+ * Divide this spline into the specified nubmer of points
130
+ * those points as an array of points.
131
+ * @param numPoints Input the nubmer of points returned
132
+ * @returns Return an array of point
133
+ */
134
+ AcGeSpline3d.prototype.getPoints = function (numPoints) {
135
+ if (numPoints === void 0) { numPoints = 100; }
136
+ var curve = this._nurbsCurve;
137
+ var points = [];
138
+ // Get the knot vector from the curve
139
+ var knots = curve.knots();
140
+ // The valid parameter range is between knots[degree] and knots[knots.length - degree - 1]
141
+ var degree = this._nurbsCurve.degree();
142
+ var startParam = knots[degree];
143
+ var endParam = knots[knots.length - degree - 1];
144
+ // Adjust step size for correct range
145
+ var step = (endParam - startParam) / (numPoints - 1);
146
+ for (var i = 0; i < numPoints; i++) {
147
+ // Map t to the correct parameter space
148
+ var t = startParam + i * step;
149
+ var point = curve.point(t);
150
+ // Sample the curve at the mapped parameter t
151
+ points.push(new AcGePoint3d(point[0], point[1], point[2]));
152
+ }
153
+ return points;
154
+ };
155
+ AcGeSpline3d.prototype.getCurvePoints = function (curve, count) {
156
+ var points = [];
157
+ var knots = curve.knots(); // Get the knot vector from the curve
158
+ // The valid parameter range is between knots[degree] and knots[knots.length - degree - 1]
159
+ var startParam = knots[3];
160
+ var endParam = knots[knots.length - 4];
161
+ var step = (endParam - startParam) / (count - 1); // Adjust step size for correct range
162
+ for (var i = 0; i < count; i++) {
163
+ var t = startParam + i * step; // Map t to the correct parameter space
164
+ points.push(curve.point(t)); // Sample the curve at the mapped parameter t
165
+ }
166
+ return points;
167
+ };
168
+ /**
169
+ * @inheritdoc
170
+ */
171
+ AcGeSpline3d.prototype.calculateBoundingBox = function () {
172
+ var points = this.getPoints(100);
173
+ return new AcGeBox3d().setFromPoints(points);
174
+ };
175
+ Object.defineProperty(AcGeSpline3d.prototype, "closed", {
176
+ get: function () {
177
+ return this._closed;
178
+ },
179
+ set: function (value) {
180
+ this._boundingBoxNeedsUpdate = true;
181
+ this._closed = value;
182
+ },
183
+ enumerable: false,
184
+ configurable: true
185
+ });
186
+ /**
187
+ * @inheritdoc
188
+ */
189
+ AcGeSpline3d.prototype.transform = function (_matrix) {
190
+ // TODO: Implement this method
191
+ this._boundingBoxNeedsUpdate = true;
192
+ return this;
193
+ };
194
+ /**
195
+ * Convert input points to points in verb-nurbs-web format
196
+ * @param points Input points to convert
197
+ * @returns Return converted points
198
+ */
199
+ AcGeSpline3d.prototype.toVerbPoints = function (points) {
200
+ var verbPoints = new Array(points.length);
201
+ points.forEach(function (point, index) {
202
+ verbPoints[index] = [point.x, point.y, point.z || 0];
203
+ });
204
+ return verbPoints;
205
+ };
206
+ /**
207
+ * Convert input points to points in geometry engine format
208
+ * @param points Input points to convert
209
+ * @returns Return converted points
210
+ */
211
+ AcGeSpline3d.prototype.toGePoints = function (points) {
212
+ var gePoints = new Array(points.length);
213
+ points.forEach(function (point, index) {
214
+ gePoints[index] = { x: point[0], y: point[1], z: point[2] };
215
+ });
216
+ return gePoints;
217
+ };
218
+ return AcGeSpline3d;
219
+ }(AcGeCurve3d));
220
+ export { AcGeSpline3d };
221
+ //# sourceMappingURL=AcGeSpline3d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcGeSpline3d.js","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,IAAI,MAAM,gBAAgB,CAAA;AAEjC,OAAO,EACL,SAAS,EAET,WAAW,EAGZ,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C;IAAkC,gCAAW;IAgB3C,sBAAY,CAAW,EAAE,CAAW,EAAE,CAAW;QAC/C,YAAA,MAAK,WAAE,SAAA;QACP,IAAM,UAAU,GACd,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;QAE9D,IAAI,UAAU,IAAI,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC;YACvC,MAAM,UAAU,CAAC,kBAAkB,CAAA;QACrC,CAAC;QAED,oCAAoC;QACpC,IAAM,MAAM,GAAG,CAAC,CAAA;QAChB,KAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB,IAAI,UAAU,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,KAAI,CAAC,UAAU,GAAG,CAAoB,CAAA;YACtC,KAAI,CAAC,qBAAqB,GAAG,CAAiC,CAAA;YAC9D,IAAM,MAAM,GAAG,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,UAAU,CAAC,CAAA;YACjD,KAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YAChE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AC,OAAO,CAAC,UAAC,KAAK,EAAE,KAAK;YAC1B,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QACF,OAAO,UAAU,CAAA;IACnB,CAAC;IAED;;;;OAIG;IACK,iCAAU,GAAlB,UAAmB,MAAkB;QACnC,IAAM,QAAQ,GAAG,IAAI,KAAK,CAAkB,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1D,MAAM,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,KAAK;YAC1B,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAC7D,CAAC,CAAC,CAAA;QACF,OAAO,QAAQ,CAAA;IACjB,CAAC;IACH,mBAAC;AAAD,CAAC,AAtND,CAAkC,WAAW,GAsN5C"}
@@ -0,0 +1,13 @@
1
+ export * from './AcGeArea2d';
2
+ export * from './AcGeShape2d';
3
+ export * from './AcGeCurve2d';
4
+ export * from './AcGeCircArc2d';
5
+ export * from './AcGeCircArc3d';
6
+ export * from './AcGeEllipseArc2d';
7
+ export * from './AcGeEllipseArc3d';
8
+ export * from './AcGePolyline2d';
9
+ export * from './AcGeLine2d';
10
+ export * from './AcGeLine3d';
11
+ export * from './AcGeLoop2d';
12
+ export * from './AcGeSpline3d';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,13 @@
1
+ export * from './AcGeArea2d';
2
+ export * from './AcGeShape2d';
3
+ export * from './AcGeCurve2d';
4
+ export * from './AcGeCircArc2d';
5
+ export * from './AcGeCircArc3d';
6
+ export * from './AcGeEllipseArc2d';
7
+ export * from './AcGeEllipseArc3d';
8
+ export * from './AcGePolyline2d';
9
+ export * from './AcGeLine2d';
10
+ export * from './AcGeLine3d';
11
+ export * from './AcGeLoop2d';
12
+ export * from './AcGeSpline3d';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './geometry';
2
+ export * from './math';
3
+ export * from './util';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './geometry';
2
+ export * from './math';
3
+ export * from './util';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,173 @@
1
+ import { AcGeVector2d, AcGeVector2dLike } from './AcGeVector2d';
2
+ /**
3
+ * The class representing an axis-aligned bounding box (AABB) in 2D space.
4
+ */
5
+ export declare class AcGeBox2d {
6
+ /**
7
+ * The lower (x, y) boundary of the box
8
+ */
9
+ min: AcGeVector2d;
10
+ /**
11
+ * The upper (x, y) boundary of the box
12
+ */
13
+ max: AcGeVector2d;
14
+ /**
15
+ * Create a 2d box bounded by min and max.
16
+ * @param min (optional) Input 2d vector representing the lower (x, y) boundary of the box.
17
+ * Set it to ( + Infinity, + Infinity ) if undefined or null provided.
18
+ * @param max (optional) Input 2d vector representing the upper (x, y) boundary of the box.
19
+ * Set it to ( - Infinity, - Infinity ) if undefined or null provided.
20
+ */
21
+ constructor(min?: AcGeVector2dLike | undefined, max?: AcGeVector2dLike | undefined);
22
+ /**
23
+ * Set the lower and upper (x, y) boundaries of this box.
24
+ * Please note that this method only copies the values from the given objects.
25
+ * @param min Input 2d vector representing the lower (x, y) boundary of the box.
26
+ * @param max Input 2d vector representing the upper (x, y) boundary of the box.
27
+ * @returns Return this box
28
+ */
29
+ set(min: AcGeVector2dLike, max: AcGeVector2dLike): this;
30
+ /**
31
+ * Set the upper and lower bounds of this box to include all of the points in points.
32
+ * @param points Input one array of 2d vector that the resulting box will contain.
33
+ * @returns Return this box
34
+ */
35
+ setFromPoints(points: AcGeVector2dLike[]): this;
36
+ /**
37
+ * Center this box on center and set this box's width and height to the values specified in size.
38
+ * @param center Input the desired center position of the box.
39
+ * @param size Input the desired x and y dimensions of the box.
40
+ * @returns Return this box
41
+ */
42
+ setFromCenterAndSize(center: AcGeVector2dLike, size: AcGeVector2dLike): this;
43
+ /**
44
+ * Return a new 2d box with the same min and max as this one.
45
+ * @returns Return a new 2d box with the same min and max as this one.
46
+ */
47
+ clone(): AcGeBox2d;
48
+ /**
49
+ * Copy the min and max from box to this box.
50
+ * @param box Input the box to copy from
51
+ * @returns Return this box
52
+ */
53
+ copy(box: AcGeBox2d): this;
54
+ /**
55
+ * Make this box empty.
56
+ * @returns Return this box
57
+ */
58
+ makeEmpty(): this;
59
+ /**
60
+ * Return true if this box includes zero points within its bounds. Note that a box with equal lower
61
+ * and upper bounds still includes one point, the one both bounds share.
62
+ * @returns Return true if this box includes zero points within its bounds.
63
+ */
64
+ isEmpty(): boolean;
65
+ /**
66
+ * Return the center point of the box as a 2d vector.
67
+ * @param target Input the result will be copied into this 2d vector.
68
+ * @returns Return the center point of the box as a 2d vector.
69
+ */
70
+ getCenter(target: AcGeVector2d): AcGeVector2d;
71
+ /**
72
+ * Return the width and height of this box.
73
+ * @param target Input the result will be copied into this 2d vector.
74
+ * @returns Return this box.
75
+ */
76
+ getSize(target: AcGeVector2d): AcGeVector2d;
77
+ /**
78
+ * Center point of this box
79
+ */
80
+ get center(): AcGeVector2d;
81
+ /**
82
+ * Return the width, height and depth of this box.
83
+ */
84
+ get size(): AcGeVector2d;
85
+ /**
86
+ * Expand the boundaries of this box to include point.
87
+ * @param point Input one point that should be included in the box.
88
+ * @returns Return this box
89
+ */
90
+ expandByPoint(point: AcGeVector2dLike): this;
91
+ /**
92
+ * Expand this box equilaterally by vector. The width of this box will be expanded by the x component
93
+ * of vector in both directions. The height of this box will be expanded by the y component of vector
94
+ * in both directions.
95
+ * @param vector Input 2d vector to expand the box by.
96
+ * @returns Return this box
97
+ */
98
+ expandByVector(vector: AcGeVector2dLike): this;
99
+ /**
100
+ * Expand each dimension of the box by scalar. If negative, the dimensions of the box will be contracted.
101
+ * @param scalar Input distance to expand the box by.
102
+ * @returns Return this box
103
+ */
104
+ expandByScalar(scalar: number): this;
105
+ /**
106
+ * Return true if the specified point lies within or on the boundaries of this box.
107
+ * @param point Input 2d point to check for inclusion.
108
+ * @returns Return true if the specified point lies within or on the boundaries of this box.
109
+ */
110
+ containsPoint(point: AcGeVector2dLike): boolean;
111
+ /**
112
+ * Return true if this box includes the entirety of box. If this and box are identical,
113
+ * this function also returns true.
114
+ * @param box Input 2d box to test for inclusion.
115
+ * @returns Return true if this box includes the entirety of box.
116
+ */
117
+ containsBox(box: AcGeBox2d): boolean;
118
+ /**
119
+ * Return a point as a proportion of this box's width and height.
120
+ * @param point Input one point
121
+ * @param target Input the result will be copied into this 2d vector.
122
+ * @returns Return a point as a proportion of this box's width and height.
123
+ */
124
+ getParameter(point: AcGeVector2dLike, target: AcGeVector2d): AcGeVector2d;
125
+ /**
126
+ * Determine whether or not this box intersects box.
127
+ * @param box Input 2d box to check for intersection against.
128
+ * @returns Return true if this box intersects box.
129
+ */
130
+ intersectsBox(box: AcGeBox2d): boolean;
131
+ /**
132
+ * Clamp the point within the bounds of this box.
133
+ * @param point Input one 2d point
134
+ * @param target Input the result will be copied into this Vector2.
135
+ * @returns Return the target
136
+ */
137
+ clampPoint(point: AcGeVector2dLike, target: AcGeVector2d): AcGeVector2d;
138
+ /**
139
+ * Return the distance from any edge of this box to the specified point. If the point lies inside of
140
+ * this box, the distance will be 0.
141
+ * @param point Input 2d vector to measure distance to.
142
+ * @returns Return the distance from any edge of this box to the specified point.
143
+ */
144
+ distanceToPoint(point: AcGeVector2dLike): number;
145
+ /**
146
+ * Return the intersection of this and box, setting the upper bound of this box to the lesser of the
147
+ * two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds.
148
+ * @param box Input box to intersect with
149
+ * @returns Return this box
150
+ */
151
+ intersect(box: AcGeBox2d): this;
152
+ /**
153
+ * Union this box with box, setting the upper bound of this box to the greater of the two boxes' upper
154
+ * bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.
155
+ * @param box Input the box that will be unioned with this box.
156
+ * @returns Return this box
157
+ */
158
+ union(box: AcGeBox2d): this;
159
+ /**
160
+ * Add offset to both the upper and lower bounds of this box, effectively moving this box offset units
161
+ * in 2D space.
162
+ * @param offset Input direction and distance of offset.
163
+ * @returns Return this box
164
+ */
165
+ translate(offset: AcGeVector2dLike): this;
166
+ /**
167
+ * Return true if this box and box share the same lower and upper bounds.
168
+ * @param box Input box to compare with this one.
169
+ * @returns Return true if this box and box share the same lower and upper bounds.
170
+ */
171
+ equals(box: AcGeBox2d): boolean;
172
+ }
173
+ //# sourceMappingURL=AcGeBox2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcGeBox2d.d.ts","sourceRoot":"","sources":["../../src/math/AcGeBox2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAI/D;;GAEG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,GAAG,EAAE,YAAY,CAAA;IACjB;;OAEG;IACH,GAAG,EAAE,YAAY,CAAA;IAEjB;;;;;;OAMG;gBAED,GAAG,GAAE,gBAAgB,GAAG,SAAqB,EAC7C,GAAG,GAAE,gBAAgB,GAAG,SAAqB;IAY/C;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB;IAOhD;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAUxC;;;;;OAKG;IACH,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB;IAQrE;;;OAGG;IACH,KAAK;IAIL;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,SAAS;IAOnB;;;OAGG;IACH,SAAS;IAOT;;;;OAIG;IACH,OAAO;IAMP;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY;IAM9B;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY;IAM5B;;OAEG;IACH,IAAI,MAAM,iBAMT;IAED;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