@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,289 @@
1
+ import { AcGeVector2d } from './AcGeVector2d';
2
+ var _vector = /*@__PURE__*/ new AcGeVector2d();
3
+ /**
4
+ * The class representing an axis-aligned bounding box (AABB) in 2D space.
5
+ */
6
+ var AcGeBox2d = /** @class */ (function () {
7
+ /**
8
+ * Create a 2d box bounded by min and max.
9
+ * @param min (optional) Input 2d vector representing the lower (x, y) boundary of the box.
10
+ * Set it to ( + Infinity, + Infinity ) if undefined or null provided.
11
+ * @param max (optional) Input 2d vector representing the upper (x, y) boundary of the box.
12
+ * Set it to ( - Infinity, - Infinity ) if undefined or null provided.
13
+ */
14
+ function AcGeBox2d(min, max) {
15
+ if (min === void 0) { min = undefined; }
16
+ if (max === void 0) { max = undefined; }
17
+ this.min =
18
+ min == null
19
+ ? new AcGeVector2d(+Infinity, +Infinity)
20
+ : new AcGeVector2d(min.x, min.y);
21
+ this.max =
22
+ max == null
23
+ ? new AcGeVector2d(-Infinity, -Infinity)
24
+ : new AcGeVector2d(max.x, max.y);
25
+ }
26
+ /**
27
+ * Set the lower and upper (x, y) boundaries of this box.
28
+ * Please note that this method only copies the values from the given objects.
29
+ * @param min Input 2d vector representing the lower (x, y) boundary of the box.
30
+ * @param max Input 2d vector representing the upper (x, y) boundary of the box.
31
+ * @returns Return this box
32
+ */
33
+ AcGeBox2d.prototype.set = function (min, max) {
34
+ this.min.copy(min);
35
+ this.max.copy(max);
36
+ return this;
37
+ };
38
+ /**
39
+ * Set the upper and lower bounds of this box to include all of the points in points.
40
+ * @param points Input one array of 2d vector that the resulting box will contain.
41
+ * @returns Return this box
42
+ */
43
+ AcGeBox2d.prototype.setFromPoints = function (points) {
44
+ this.makeEmpty();
45
+ for (var i = 0, il = points.length; i < il; i++) {
46
+ this.expandByPoint(points[i]);
47
+ }
48
+ return this;
49
+ };
50
+ /**
51
+ * Center this box on center and set this box's width and height to the values specified in size.
52
+ * @param center Input the desired center position of the box.
53
+ * @param size Input the desired x and y dimensions of the box.
54
+ * @returns Return this box
55
+ */
56
+ AcGeBox2d.prototype.setFromCenterAndSize = function (center, size) {
57
+ var halfSize = _vector.copy(size).multiplyScalar(0.5);
58
+ this.min.copy(center).sub(halfSize);
59
+ this.max.copy(center).add(halfSize);
60
+ return this;
61
+ };
62
+ /**
63
+ * Return a new 2d box with the same min and max as this one.
64
+ * @returns Return a new 2d box with the same min and max as this one.
65
+ */
66
+ AcGeBox2d.prototype.clone = function () {
67
+ return new AcGeBox2d().copy(this);
68
+ };
69
+ /**
70
+ * Copy the min and max from box to this box.
71
+ * @param box Input the box to copy from
72
+ * @returns Return this box
73
+ */
74
+ AcGeBox2d.prototype.copy = function (box) {
75
+ this.min.copy(box.min);
76
+ this.max.copy(box.max);
77
+ return this;
78
+ };
79
+ /**
80
+ * Make this box empty.
81
+ * @returns Return this box
82
+ */
83
+ AcGeBox2d.prototype.makeEmpty = function () {
84
+ this.min.x = this.min.y = +Infinity;
85
+ this.max.x = this.max.y = -Infinity;
86
+ return this;
87
+ };
88
+ /**
89
+ * Return true if this box includes zero points within its bounds. Note that a box with equal lower
90
+ * and upper bounds still includes one point, the one both bounds share.
91
+ * @returns Return true if this box includes zero points within its bounds.
92
+ */
93
+ AcGeBox2d.prototype.isEmpty = function () {
94
+ // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
95
+ return this.max.x < this.min.x || this.max.y < this.min.y;
96
+ };
97
+ /**
98
+ * Return the center point of the box as a 2d vector.
99
+ * @param target Input the result will be copied into this 2d vector.
100
+ * @returns Return the center point of the box as a 2d vector.
101
+ */
102
+ AcGeBox2d.prototype.getCenter = function (target) {
103
+ return this.isEmpty()
104
+ ? target.set(0, 0)
105
+ : target.addVectors(this.min, this.max).multiplyScalar(0.5);
106
+ };
107
+ /**
108
+ * Return the width and height of this box.
109
+ * @param target Input the result will be copied into this 2d vector.
110
+ * @returns Return this box.
111
+ */
112
+ AcGeBox2d.prototype.getSize = function (target) {
113
+ return this.isEmpty()
114
+ ? target.set(0, 0)
115
+ : target.subVectors(this.max, this.min);
116
+ };
117
+ Object.defineProperty(AcGeBox2d.prototype, "center", {
118
+ /**
119
+ * Center point of this box
120
+ */
121
+ get: function () {
122
+ return this.isEmpty()
123
+ ? new AcGeVector2d(0, 0)
124
+ : new AcGeVector2d(0, 0)
125
+ .addVectors(this.min, this.max)
126
+ .multiplyScalar(0.5);
127
+ },
128
+ enumerable: false,
129
+ configurable: true
130
+ });
131
+ Object.defineProperty(AcGeBox2d.prototype, "size", {
132
+ /**
133
+ * Return the width, height and depth of this box.
134
+ */
135
+ get: function () {
136
+ return this.isEmpty()
137
+ ? new AcGeVector2d(0, 0)
138
+ : new AcGeVector2d(0, 0).subVectors(this.max, this.min);
139
+ },
140
+ enumerable: false,
141
+ configurable: true
142
+ });
143
+ /**
144
+ * Expand the boundaries of this box to include point.
145
+ * @param point Input one point that should be included in the box.
146
+ * @returns Return this box
147
+ */
148
+ AcGeBox2d.prototype.expandByPoint = function (point) {
149
+ this.min.min(point);
150
+ this.max.max(point);
151
+ return this;
152
+ };
153
+ /**
154
+ * Expand this box equilaterally by vector. The width of this box will be expanded by the x component
155
+ * of vector in both directions. The height of this box will be expanded by the y component of vector
156
+ * in both directions.
157
+ * @param vector Input 2d vector to expand the box by.
158
+ * @returns Return this box
159
+ */
160
+ AcGeBox2d.prototype.expandByVector = function (vector) {
161
+ this.min.sub(vector);
162
+ this.max.add(vector);
163
+ return this;
164
+ };
165
+ /**
166
+ * Expand each dimension of the box by scalar. If negative, the dimensions of the box will be contracted.
167
+ * @param scalar Input distance to expand the box by.
168
+ * @returns Return this box
169
+ */
170
+ AcGeBox2d.prototype.expandByScalar = function (scalar) {
171
+ this.min.addScalar(-scalar);
172
+ this.max.addScalar(scalar);
173
+ return this;
174
+ };
175
+ /**
176
+ * Return true if the specified point lies within or on the boundaries of this box.
177
+ * @param point Input 2d point to check for inclusion.
178
+ * @returns Return true if the specified point lies within or on the boundaries of this box.
179
+ */
180
+ AcGeBox2d.prototype.containsPoint = function (point) {
181
+ return point.x < this.min.x ||
182
+ point.x > this.max.x ||
183
+ point.y < this.min.y ||
184
+ point.y > this.max.y
185
+ ? false
186
+ : true;
187
+ };
188
+ /**
189
+ * Return true if this box includes the entirety of box. If this and box are identical,
190
+ * this function also returns true.
191
+ * @param box Input 2d box to test for inclusion.
192
+ * @returns Return true if this box includes the entirety of box.
193
+ */
194
+ AcGeBox2d.prototype.containsBox = function (box) {
195
+ return (this.min.x <= box.min.x &&
196
+ box.max.x <= this.max.x &&
197
+ this.min.y <= box.min.y &&
198
+ box.max.y <= this.max.y);
199
+ };
200
+ /**
201
+ * Return a point as a proportion of this box's width and height.
202
+ * @param point Input one point
203
+ * @param target Input the result will be copied into this 2d vector.
204
+ * @returns Return a point as a proportion of this box's width and height.
205
+ */
206
+ AcGeBox2d.prototype.getParameter = function (point, target) {
207
+ // This can potentially have a divide by zero if the box
208
+ // has a size dimension of 0.
209
+ return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));
210
+ };
211
+ /**
212
+ * Determine whether or not this box intersects box.
213
+ * @param box Input 2d box to check for intersection against.
214
+ * @returns Return true if this box intersects box.
215
+ */
216
+ AcGeBox2d.prototype.intersectsBox = function (box) {
217
+ // using 4 splitting planes to rule out intersections
218
+ return box.max.x < this.min.x ||
219
+ box.min.x > this.max.x ||
220
+ box.max.y < this.min.y ||
221
+ box.min.y > this.max.y
222
+ ? false
223
+ : true;
224
+ };
225
+ /**
226
+ * Clamp the point within the bounds of this box.
227
+ * @param point Input one 2d point
228
+ * @param target Input the result will be copied into this Vector2.
229
+ * @returns Return the target
230
+ */
231
+ AcGeBox2d.prototype.clampPoint = function (point, target) {
232
+ return target.copy(point).clamp(this.min, this.max);
233
+ };
234
+ /**
235
+ * Return the distance from any edge of this box to the specified point. If the point lies inside of
236
+ * this box, the distance will be 0.
237
+ * @param point Input 2d vector to measure distance to.
238
+ * @returns Return the distance from any edge of this box to the specified point.
239
+ */
240
+ AcGeBox2d.prototype.distanceToPoint = function (point) {
241
+ return this.clampPoint(point, _vector).distanceTo(point);
242
+ };
243
+ /**
244
+ * Return the intersection of this and box, setting the upper bound of this box to the lesser of the
245
+ * two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds.
246
+ * @param box Input box to intersect with
247
+ * @returns Return this box
248
+ */
249
+ AcGeBox2d.prototype.intersect = function (box) {
250
+ this.min.max(box.min);
251
+ this.max.min(box.max);
252
+ if (this.isEmpty())
253
+ this.makeEmpty();
254
+ return this;
255
+ };
256
+ /**
257
+ * Union this box with box, setting the upper bound of this box to the greater of the two boxes' upper
258
+ * bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.
259
+ * @param box Input the box that will be unioned with this box.
260
+ * @returns Return this box
261
+ */
262
+ AcGeBox2d.prototype.union = function (box) {
263
+ this.min.min(box.min);
264
+ this.max.max(box.max);
265
+ return this;
266
+ };
267
+ /**
268
+ * Add offset to both the upper and lower bounds of this box, effectively moving this box offset units
269
+ * in 2D space.
270
+ * @param offset Input direction and distance of offset.
271
+ * @returns Return this box
272
+ */
273
+ AcGeBox2d.prototype.translate = function (offset) {
274
+ this.min.add(offset);
275
+ this.max.add(offset);
276
+ return this;
277
+ };
278
+ /**
279
+ * Return true if this box and box share the same lower and upper bounds.
280
+ * @param box Input box to compare with this one.
281
+ * @returns Return true if this box and box share the same lower and upper bounds.
282
+ */
283
+ AcGeBox2d.prototype.equals = function (box) {
284
+ return box.min.equals(this.min) && box.max.equals(this.max);
285
+ };
286
+ return AcGeBox2d;
287
+ }());
288
+ export { AcGeBox2d };
289
+ //# sourceMappingURL=AcGeBox2d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcGeBox2d.js","sourceRoot":"","sources":["../../src/math/AcGeBox2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAA;AAE/D,IAAM,OAAO,GAAG,aAAa,CAAC,IAAI,YAAY,EAAE,CAAA;AAEhD;;GAEG;AACH;IAUE;;;;;;OAMG;IACH,mBACE,GAA6C,EAC7C,GAA6C;QAD7C,oBAAA,EAAA,eAA6C;QAC7C,oBAAA,EAAA,eAA6C;QAE7C,IAAI,CAAC,GAAG;YACN,GAAG,IAAI,IAAI;gBACT,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACxC,CAAC,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QACpC,IAAI,CAAC,GAAG;YACN,GAAG,IAAI,IAAI;gBACT,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACxC,CAAC,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;IACtC,CAAC;IAED;;;;;;OAMG;IACH,uBAAG,GAAH,UAAI,GAAqB,EAAE,GAAqB;QAC9C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAElB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,iCAAa,GAAb,UAAc,MAA0B;QACtC,IAAI,CAAC,SAAS,EAAE,CAAA;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAA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import { AcGeVector3d, AcGeVector3dLike } from './AcGeVector3d';
4
+ /**
5
+ * The class representing an axis-aligned bounding box (AABB) in 3d space.
6
+ */
7
+ export declare class AcGeBox3d {
8
+ /**
9
+ * The lower (x, y, z) boundary of the box.
10
+ */
11
+ min: AcGeVector3d;
12
+ /**
13
+ * The upper (x, y, z) boundary of the box.
14
+ */
15
+ max: AcGeVector3d;
16
+ /**
17
+ * Create a 3d box bounded by min and max.
18
+ * @param min (optional) Input the lower (x, y, z) boundary of the box.
19
+ * Set it to ( + Infinity, + Infinity, + Infinity ) if undefined or null provided.
20
+ * @param max (optional) Input the upper (x, y, z) boundary of the box.
21
+ * Set it to ( - Infinity, - Infinity, - Infinity ) if undefined or null provided.
22
+ */
23
+ constructor(min?: AcGeVector3dLike | undefined, max?: AcGeVector3dLike | undefined);
24
+ /**
25
+ * Set the lower and upper (x, y, z) boundaries of this box.
26
+ * Please note that this method only copies the values from the given objects.
27
+ * @param min Input the lower (x, y, z) boundary of the box.
28
+ * @param max Input the upper (x, y, z) boundary of the box.
29
+ * @returns Return this box.
30
+ */
31
+ set(min: AcGeVector3dLike, max: AcGeVector3dLike): this;
32
+ /**
33
+ * Set the upper and lower bounds of this box to include all of the data in array.
34
+ * @param array Input an array of position data that the resulting box will envelop.
35
+ * @returns Return this box
36
+ */
37
+ setFromArray(array: number[]): this;
38
+ /**
39
+ * Set the upper and lower bounds of this box to include all of the points in points.
40
+ * @param points Input an array of 3d point or 3d vector that the resulting box will contain.
41
+ * @returns Return this box
42
+ */
43
+ setFromPoints(points: AcGeVector3dLike[]): this;
44
+ /**
45
+ * Center this box on center and set this box's width, height and depth to the values specified in size
46
+ * @param center Input the desired center position of the box.
47
+ * @param size Input the desired x, y and z dimensions of the box.
48
+ * @returns Return this box
49
+ */
50
+ setFromCenterAndSize(center: AcGeVector3dLike, size: AcGeVector3dLike): this;
51
+ /**
52
+ * Return a new box with the same min and max as this one.
53
+ * @returns Return a new box with the same min and max as this one.
54
+ */
55
+ clone(): AcGeBox3d;
56
+ /**
57
+ * Copy the min and max from box to this box.
58
+ * @param box Input box to copy.
59
+ * @returns Return this box
60
+ */
61
+ copy(box: AcGeBox3d): this;
62
+ /**
63
+ * Make this box empty.
64
+ * @returns Return this box
65
+ */
66
+ makeEmpty(): this;
67
+ /**
68
+ * Return true if this box includes zero points within its bounds.
69
+ * Note that a box with equal lower and upper bounds still includes one point, the one both bounds share.
70
+ * @returns Return true if this box includes zero points within its bounds.
71
+ */
72
+ isEmpty(): boolean;
73
+ /**
74
+ * Return the center point of the box as a 3d vector.
75
+ * @param target Input the result copied into this 3d vector.
76
+ * @returns Return the center point of the box
77
+ */
78
+ getCenter(target: AcGeVector3d): AcGeVector3d;
79
+ /**
80
+ * Return the width, height and depth of this box.
81
+ * @param target Return the result copied into this 3d vector.
82
+ * @returns Return the width, height and depth of this box.
83
+ */
84
+ getSize(target: AcGeVector3d): AcGeVector3d;
85
+ /**
86
+ * Center point of this box
87
+ */
88
+ get center(): AcGeVector3d;
89
+ /**
90
+ * Return the width, height and depth of this box.
91
+ */
92
+ get size(): AcGeVector3d;
93
+ /**
94
+ * Expand the boundaries of this box to include point.
95
+ * @param point
96
+ * @returns
97
+ */
98
+ expandByPoint(point: AcGeVector3dLike): this;
99
+ /**
100
+ * Expand this box equilaterally by vector. The width of this box will be expanded by the x component
101
+ * of vector in both directions. The height of this box will be expanded by the y component of vector
102
+ * in both directions. The depth of this box will be expanded by the z component of vector in both
103
+ * directions.
104
+ * @param vector Input one 3d vector to expand the box by.
105
+ * @returns Return this box
106
+ */
107
+ expandByVector(vector: AcGeVector3dLike): this;
108
+ /**
109
+ * Expand each dimension of the box by scalar. If negative, the dimensions of the box will be contracted.
110
+ * @param scalar Input distance to expand the box by.
111
+ * @returns Return this box
112
+ */
113
+ expandByScalar(scalar: number): this;
114
+ /**
115
+ * Return true if the specified point lies within or on the boundaries of this box.
116
+ * @param point Input point to check for inclusion.
117
+ * @returns Return true if the specified point lies within or on the boundaries of this box.
118
+ */
119
+ containsPoint(point: AcGeVector3dLike): boolean;
120
+ /**
121
+ * Return true if this box includes the entirety of box. If this and box are identical,
122
+ * this function also returns true.
123
+ * @param box Input 3d box to test for inclusion.
124
+ * @returns Return true if this box includes the entirety of box.
125
+ */
126
+ containsBox(box: AcGeBox3d): boolean;
127
+ /**
128
+ * Return a point as a proportion of this box's width, height and depth.
129
+ * @param point Input one point
130
+ * @param target Input the result will be copied into this Vector3.
131
+ * @returns Return one point
132
+ */
133
+ getParameter(point: AcGeVector3dLike, target: AcGeVector3d): AcGeVector3d;
134
+ /**
135
+ * Determine whether or not this box intersects box.
136
+ * @param box Input 3d box to check for intersection against.
137
+ * @returns Return true if this box intersects the specified box.
138
+ */
139
+ intersectsBox(box: AcGeBox3d): boolean;
140
+ /**
141
+ * Determine whether or not this box intersects plane.
142
+ * @param plane Input the plane to check for intersection against.
143
+ * @returns Return true if this box intersects the specified plane.
144
+ */
145
+ intersectsPlane(plane: AcGePlane): boolean;
146
+ /**
147
+ * Clamp the point within the bounds of this box.
148
+ * @param point Input the point to clamp.
149
+ * @param target Input the result will be copied into this 3d vector.
150
+ * @returns Return the target
151
+ */
152
+ clampPoint(point: AcGeVector3dLike, target: AcGeVector3d): AcGeVector3d;
153
+ /**
154
+ * Returns the distance from any edge of this box to the specified point. If the point lies inside of
155
+ * this box, the distance will be 0.
156
+ * @param point Input one 3d point to measure distance to.
157
+ * @returns Return the distance from any edge of this box to the specified point.
158
+ */
159
+ distanceToPoint(point: AcGeVector3dLike): number;
160
+ /**
161
+ * Compute the intersection of this and box, setting the upper bound of this box to the lesser of the
162
+ * two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds.
163
+ * If there's no overlap, makes this box empty.
164
+ * @param box Input 3d box to intersect with.
165
+ * @returns Return this box
166
+ */
167
+ intersect(box: AcGeBox3d): this;
168
+ /**
169
+ * Compute the union of this box and box, setting the upper bound of this box to the greater of the two
170
+ * boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.
171
+ * @param box Input the 3d box that will be unioned with this box.
172
+ * @returns Return this box
173
+ */
174
+ union(box: AcGeBox3d): this;
175
+ /**
176
+ * Transform this box with the supplied matrix.
177
+ * @param matrix Input 4x4 matrix to apply
178
+ * @returns Return this box
179
+ */
180
+ applyMatrix4(matrix: AcGeMatrix3d): this;
181
+ /**
182
+ * Add offset to both the upper and lower bounds of this box, effectively moving this box offset units
183
+ * in 3d space.
184
+ * @param offset Input direction and distance of offset.
185
+ * @returns Return this box
186
+ */
187
+ translate(offset: AcGeVector3dLike): this;
188
+ /**
189
+ * Return true if this box and box share the same lower and upper bounds.
190
+ * @param box Input box to compare with this one.
191
+ * @returns Return true if this box and box share the same lower and upper bounds.
192
+ */
193
+ equals(box: AcGeBox3d): boolean;
194
+ }
195
+ //# sourceMappingURL=AcGeBox3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcGeBox3d.d.ts","sourceRoot":"","sources":["../../src/math/AcGeBox3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAE/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,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE;IAQ5B;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAUxC;;;;;OAKG;IACH,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