@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,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,8BAAM;QAHV;;WAEG;aACH;YACE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACvB,CAAC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;;;OAAA;IAED;;OAEG;IACH,yCAAoB,GAApB;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;QAC9B,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,UAAU,CAAC,GAAG,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,SAAS,EAAE,CAAA;QACxB,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A;QACrC,eAAe,CAAC,OAAO,CAAC,UAAA,MAAM;YAC5B,aAAa,CAAC,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;QAC3D,CAAC,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACK,6CAAwB,GAAhC,UAAiC,aAA0B;QACzD,IAAM,aAAa,GAAsC,EAAE,CAAA;QAC3D,aAAa,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,KAAK;YAC/B,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;YACrB,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAA;YACrC,aAAa,CAAC,IAAI,CAAC;gBACjB,IAAI,MAAA;gBACJ,KAAK,OAAA;aACN,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,aAAa,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAA;QACxB,CAAC,CAAC,CAAA;QACF,IAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,aAAa,CAAC,OAAO,CAAC,UAAA,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC;IACH,iBAAC;AAAD,CAAC,AA7JD,CAAgC,WAAW,GA6J1C"}
@@ -0,0 +1,108 @@
1
+ import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d, AcGePoint2dLike } from '../math';
2
+ import { AcGeCurve2d } from './AcGeCurve2d';
3
+ /**
4
+ * Represent a circular arc.
5
+ */
6
+ export declare class AcGeCircArc2d extends AcGeCurve2d {
7
+ private _center;
8
+ private _radius;
9
+ private _startAngle;
10
+ private _endAngle;
11
+ private _clockwise;
12
+ constructor(p1: AcGePoint2dLike, p2: AcGePoint2dLike, p3: AcGePoint2dLike);
13
+ constructor(start: AcGePoint2dLike, end: AcGePoint2dLike, bulge: number);
14
+ constructor(center: AcGePoint2dLike, radius: number, startAngle: number, endAngle: number, clockwise: boolean);
15
+ /**
16
+ * Create arc by three points
17
+ * @param p1 Input the start point
18
+ * @param p2 Input one point between the start point and the end point
19
+ * @param p3 Input the end point
20
+ */
21
+ private createByThreePoints;
22
+ /**
23
+ * Create circular arc by two points and one bugle factor
24
+ * @param from Input start point
25
+ * @param to Input end point
26
+ * @param bulge Input the bulge factor used to indicate how much of an arc segment is present at this
27
+ * vertex. The bulge factor is the tangent of one fourth the included angle for an arc segment, made
28
+ * negative if the arc goes clockwise from the start point to the endpoint. A bulge of 0 indicates a
29
+ * straight segment, and a bulge of 1 is a semicircle. Get more details from the following links.
30
+ * - https://ezdxf.readthedocs.io/en/stable/dxfentities/lwpolyline.html
31
+ * - https://www.afralisp.net/archive/lisp/Bulges1.htm
32
+ */
33
+ private createByStartEndPointsAndBulge;
34
+ /**
35
+ * Center of circular arc
36
+ */
37
+ get center(): AcGePoint2d;
38
+ set center(value: AcGePoint2dLike);
39
+ /**
40
+ * Radius of circular arc
41
+ */
42
+ get radius(): number;
43
+ set radius(value: number);
44
+ /**
45
+ * Start angle in radians of circular arc in the range 0 to 2 * PI.
46
+ */
47
+ get startAngle(): number;
48
+ set startAngle(value: number);
49
+ /**
50
+ * End angle in radians of circular arc in the range 0 to 2 * PI.
51
+ */
52
+ get endAngle(): number;
53
+ set endAngle(value: number);
54
+ /**
55
+ * Angle between endAngle and startAngle in range 0 to 2*PI
56
+ */
57
+ get deltaAngle(): number;
58
+ /**
59
+ * Rotation direction of the arc.
60
+ */
61
+ get clockwise(): boolean;
62
+ set clockwise(value: boolean);
63
+ /**
64
+ * Start point of circular arc
65
+ */
66
+ get startPoint(): AcGePoint2d;
67
+ /**
68
+ * End point of circular arc
69
+ */
70
+ get endPoint(): AcGePoint2d;
71
+ /**
72
+ * Middle point of circular arc
73
+ */
74
+ get midPoint(): AcGePoint2d;
75
+ /**
76
+ * Return true if its start point is identical to its end point. Otherwise, return false.
77
+ */
78
+ get closed(): boolean;
79
+ /**
80
+ * @inheritdoc
81
+ */
82
+ calculateBoundingBox(): AcGeBox2d;
83
+ /**
84
+ * Get length of circular arc
85
+ */
86
+ get length(): number;
87
+ /**
88
+ * @inheritdoc
89
+ */
90
+ transform(_matrix: AcGeMatrix2d): this;
91
+ /**
92
+ * @inheritdoc
93
+ */
94
+ clone(): AcGeCircArc2d;
95
+ /**
96
+ * Calculate a point on the ellipse at a given angle.
97
+ * @param angle Input the angle in radians where the point is to be calculated.
98
+ * @returns Return the 2d coordinates of the point on the circular arc.
99
+ */
100
+ getPointAtAngle(angle: number): AcGePoint2d;
101
+ /**
102
+ * Divide this arc into the specified nubmer of points and return those points as an array of points.
103
+ * @param numPoints Input the nubmer of points returned
104
+ * @returns Return an array of points
105
+ */
106
+ getPoints(numPoints?: number): AcGePoint2d[];
107
+ }
108
+ //# sourceMappingURL=AcGeCircArc2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcGeCircArc2d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeCircArc2d.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAU;gBAEhB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe;gBAC7D,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EA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