@mlightcad/geometry-engine 3.0.2 → 3.0.4

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 (159) hide show
  1. package/package.json +3 -3
  2. package/dist/geometry-engine.js +0 -10702
  3. package/dist/geometry-engine.umd.cjs +0 -4
  4. package/lib/geometry/AcGeArea2d.d.ts +0 -61
  5. package/lib/geometry/AcGeArea2d.d.ts.map +0 -1
  6. package/lib/geometry/AcGeArea2d.js +0 -174
  7. package/lib/geometry/AcGeArea2d.js.map +0 -1
  8. package/lib/geometry/AcGeCatmullRomCurve3d.d.ts +0 -146
  9. package/lib/geometry/AcGeCatmullRomCurve3d.d.ts.map +0 -1
  10. package/lib/geometry/AcGeCatmullRomCurve3d.js +0 -358
  11. package/lib/geometry/AcGeCatmullRomCurve3d.js.map +0 -1
  12. package/lib/geometry/AcGeCircArc2d.d.ts +0 -132
  13. package/lib/geometry/AcGeCircArc2d.d.ts.map +0 -1
  14. package/lib/geometry/AcGeCircArc2d.js +0 -473
  15. package/lib/geometry/AcGeCircArc2d.js.map +0 -1
  16. package/lib/geometry/AcGeCircArc3d.d.ts +0 -138
  17. package/lib/geometry/AcGeCircArc3d.d.ts.map +0 -1
  18. package/lib/geometry/AcGeCircArc3d.js +0 -447
  19. package/lib/geometry/AcGeCircArc3d.js.map +0 -1
  20. package/lib/geometry/AcGeCurve2d.d.ts +0 -85
  21. package/lib/geometry/AcGeCurve2d.d.ts.map +0 -1
  22. package/lib/geometry/AcGeCurve2d.js +0 -213
  23. package/lib/geometry/AcGeCurve2d.js.map +0 -1
  24. package/lib/geometry/AcGeCurve3d.d.ts +0 -27
  25. package/lib/geometry/AcGeCurve3d.d.ts.map +0 -1
  26. package/lib/geometry/AcGeCurve3d.js +0 -29
  27. package/lib/geometry/AcGeCurve3d.js.map +0 -1
  28. package/lib/geometry/AcGeEllipseArc2d.d.ts +0 -105
  29. package/lib/geometry/AcGeEllipseArc2d.d.ts.map +0 -1
  30. package/lib/geometry/AcGeEllipseArc2d.js +0 -292
  31. package/lib/geometry/AcGeEllipseArc2d.js.map +0 -1
  32. package/lib/geometry/AcGeEllipseArc3d.d.ts +0 -142
  33. package/lib/geometry/AcGeEllipseArc3d.d.ts.map +0 -1
  34. package/lib/geometry/AcGeEllipseArc3d.js +0 -459
  35. package/lib/geometry/AcGeEllipseArc3d.js.map +0 -1
  36. package/lib/geometry/AcGeLine2d.d.ts +0 -56
  37. package/lib/geometry/AcGeLine2d.d.ts.map +0 -1
  38. package/lib/geometry/AcGeLine2d.js +0 -125
  39. package/lib/geometry/AcGeLine2d.js.map +0 -1
  40. package/lib/geometry/AcGeLine3d.d.ts +0 -134
  41. package/lib/geometry/AcGeLine3d.d.ts.map +0 -1
  42. package/lib/geometry/AcGeLine3d.js +0 -291
  43. package/lib/geometry/AcGeLine3d.js.map +0 -1
  44. package/lib/geometry/AcGeLoop2d.d.ts +0 -59
  45. package/lib/geometry/AcGeLoop2d.d.ts.map +0 -1
  46. package/lib/geometry/AcGeLoop2d.js +0 -141
  47. package/lib/geometry/AcGeLoop2d.js.map +0 -1
  48. package/lib/geometry/AcGeNurbsCurve.d.ts +0 -73
  49. package/lib/geometry/AcGeNurbsCurve.d.ts.map +0 -1
  50. package/lib/geometry/AcGeNurbsCurve.js +0 -172
  51. package/lib/geometry/AcGeNurbsCurve.js.map +0 -1
  52. package/lib/geometry/AcGePolyline2d.d.ts +0 -90
  53. package/lib/geometry/AcGePolyline2d.d.ts.map +0 -1
  54. package/lib/geometry/AcGePolyline2d.js +0 -224
  55. package/lib/geometry/AcGePolyline2d.js.map +0 -1
  56. package/lib/geometry/AcGeShape.d.ts +0 -12
  57. package/lib/geometry/AcGeShape.d.ts.map +0 -1
  58. package/lib/geometry/AcGeShape.js +0 -22
  59. package/lib/geometry/AcGeShape.js.map +0 -1
  60. package/lib/geometry/AcGeShape2d.d.ts +0 -31
  61. package/lib/geometry/AcGeShape2d.d.ts.map +0 -1
  62. package/lib/geometry/AcGeShape2d.js +0 -51
  63. package/lib/geometry/AcGeShape2d.js.map +0 -1
  64. package/lib/geometry/AcGeShape3d.d.ts +0 -33
  65. package/lib/geometry/AcGeShape3d.d.ts.map +0 -1
  66. package/lib/geometry/AcGeShape3d.js +0 -52
  67. package/lib/geometry/AcGeShape3d.js.map +0 -1
  68. package/lib/geometry/AcGeSpline3d.d.ts +0 -99
  69. package/lib/geometry/AcGeSpline3d.d.ts.map +0 -1
  70. package/lib/geometry/AcGeSpline3d.js +0 -350
  71. package/lib/geometry/AcGeSpline3d.js.map +0 -1
  72. package/lib/geometry/index.d.ts +0 -15
  73. package/lib/geometry/index.d.ts.map +0 -1
  74. package/lib/geometry/index.js +0 -15
  75. package/lib/geometry/index.js.map +0 -1
  76. package/lib/index.d.ts +0 -4
  77. package/lib/index.d.ts.map +0 -1
  78. package/lib/index.js +0 -4
  79. package/lib/index.js.map +0 -1
  80. package/lib/math/AcGeBox2d.d.ts +0 -173
  81. package/lib/math/AcGeBox2d.d.ts.map +0 -1
  82. package/lib/math/AcGeBox2d.js +0 -289
  83. package/lib/math/AcGeBox2d.js.map +0 -1
  84. package/lib/math/AcGeBox3d.d.ts +0 -195
  85. package/lib/math/AcGeBox3d.d.ts.map +0 -1
  86. package/lib/math/AcGeBox3d.js +0 -378
  87. package/lib/math/AcGeBox3d.js.map +0 -1
  88. package/lib/math/AcGeEuler.d.ts +0 -133
  89. package/lib/math/AcGeEuler.d.ts.map +0 -1
  90. package/lib/math/AcGeEuler.js +0 -358
  91. package/lib/math/AcGeEuler.js.map +0 -1
  92. package/lib/math/AcGeMatrix2d.d.ts +0 -203
  93. package/lib/math/AcGeMatrix2d.d.ts.map +0 -1
  94. package/lib/math/AcGeMatrix2d.js +0 -393
  95. package/lib/math/AcGeMatrix2d.js.map +0 -1
  96. package/lib/math/AcGeMatrix3d.d.ts +0 -279
  97. package/lib/math/AcGeMatrix3d.d.ts.map +0 -1
  98. package/lib/math/AcGeMatrix3d.js +0 -1037
  99. package/lib/math/AcGeMatrix3d.js.map +0 -1
  100. package/lib/math/AcGePlane.d.ts +0 -131
  101. package/lib/math/AcGePlane.d.ts.map +0 -1
  102. package/lib/math/AcGePlane.js +0 -218
  103. package/lib/math/AcGePlane.js.map +0 -1
  104. package/lib/math/AcGePoint.d.ts +0 -4
  105. package/lib/math/AcGePoint.d.ts.map +0 -1
  106. package/lib/math/AcGePoint.js +0 -2
  107. package/lib/math/AcGePoint.js.map +0 -1
  108. package/lib/math/AcGePoint2d.d.ts +0 -17
  109. package/lib/math/AcGePoint2d.d.ts.map +0 -1
  110. package/lib/math/AcGePoint2d.js +0 -40
  111. package/lib/math/AcGePoint2d.js.map +0 -1
  112. package/lib/math/AcGePoint3d.d.ts +0 -18
  113. package/lib/math/AcGePoint3d.d.ts.map +0 -1
  114. package/lib/math/AcGePoint3d.js +0 -43
  115. package/lib/math/AcGePoint3d.js.map +0 -1
  116. package/lib/math/AcGeQuaternion.d.ts +0 -230
  117. package/lib/math/AcGeQuaternion.d.ts.map +0 -1
  118. package/lib/math/AcGeQuaternion.js +0 -666
  119. package/lib/math/AcGeQuaternion.js.map +0 -1
  120. package/lib/math/AcGeVector.d.ts +0 -9
  121. package/lib/math/AcGeVector.d.ts.map +0 -1
  122. package/lib/math/AcGeVector.js +0 -2
  123. package/lib/math/AcGeVector.js.map +0 -1
  124. package/lib/math/AcGeVector2d.d.ts +0 -361
  125. package/lib/math/AcGeVector2d.d.ts.map +0 -1
  126. package/lib/math/AcGeVector2d.js +0 -622
  127. package/lib/math/AcGeVector2d.js.map +0 -1
  128. package/lib/math/AcGeVector3d.d.ts +0 -493
  129. package/lib/math/AcGeVector3d.d.ts.map +0 -1
  130. package/lib/math/AcGeVector3d.js +0 -868
  131. package/lib/math/AcGeVector3d.js.map +0 -1
  132. package/lib/math/index.d.ts +0 -14
  133. package/lib/math/index.d.ts.map +0 -1
  134. package/lib/math/index.js +0 -14
  135. package/lib/math/index.js.map +0 -1
  136. package/lib/util/AcGeConstants.d.ts +0 -19
  137. package/lib/util/AcGeConstants.d.ts.map +0 -1
  138. package/lib/util/AcGeConstants.js +0 -25
  139. package/lib/util/AcGeConstants.js.map +0 -1
  140. package/lib/util/AcGeGeometryUtil.d.ts +0 -16
  141. package/lib/util/AcGeGeometryUtil.d.ts.map +0 -1
  142. package/lib/util/AcGeGeometryUtil.js +0 -56
  143. package/lib/util/AcGeGeometryUtil.js.map +0 -1
  144. package/lib/util/AcGeMathUtil.d.ts +0 -203
  145. package/lib/util/AcGeMathUtil.d.ts.map +0 -1
  146. package/lib/util/AcGeMathUtil.js +0 -585
  147. package/lib/util/AcGeMathUtil.js.map +0 -1
  148. package/lib/util/AcGeNurbsUtil.d.ts +0 -34
  149. package/lib/util/AcGeNurbsUtil.d.ts.map +0 -1
  150. package/lib/util/AcGeNurbsUtil.js +0 -218
  151. package/lib/util/AcGeNurbsUtil.js.map +0 -1
  152. package/lib/util/AcGeTol.d.ts +0 -91
  153. package/lib/util/AcGeTol.d.ts.map +0 -1
  154. package/lib/util/AcGeTol.js +0 -83
  155. package/lib/util/AcGeTol.js.map +0 -1
  156. package/lib/util/index.d.ts +0 -6
  157. package/lib/util/index.d.ts.map +0 -1
  158. package/lib/util/index.js +0 -6
  159. package/lib/util/index.js.map +0 -1
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './geometry';
2
- export * from './math';
3
- export * from './util';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 DELETED
@@ -1,4 +0,0 @@
1
- export * from './geometry';
2
- export * from './math';
3
- export * from './util';
4
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
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"}
@@ -1,173 +0,0 @@
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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AAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAU1D;;;;OAIG;IACH,aAAa,CAAC,GAAG,EAAE,SAAS;IAW5B;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IAIxD;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,gBAAgB;IAIvC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,SAAS;IASxB;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,SAAS;IAOpB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB;IAOlC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,SAAS;CAGtB"}
@@ -1,289 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcGeBox2d.js","sourceRoot":"","sources":["../../src/math/AcGeBox2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAo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