plotboilerplate 1.12.10 → 1.16.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.
- package/README.md +5 -1
- package/changelog.md +50 -0
- package/dist/index.esm.js +999 -510
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +1013 -509
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/BezierPath.d.ts +45 -2
- package/src/cjs/BezierPath.js +114 -18
- package/src/cjs/BezierPath.js.map +1 -1
- package/src/cjs/Circle.d.ts +25 -10
- package/src/cjs/Circle.js +38 -33
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +27 -13
- package/src/cjs/CircleSector.js +38 -23
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +17 -1
- package/src/cjs/CubicBezierCurve.js +78 -79
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/KeyHandler.d.ts +10 -3
- package/src/cjs/KeyHandler.js +28 -23
- package/src/cjs/KeyHandler.js.map +1 -1
- package/src/cjs/Line.d.ts +2 -1
- package/src/cjs/Line.js +19 -18
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/MouseHandler.js +43 -53
- package/src/cjs/MouseHandler.js.map +1 -1
- package/src/cjs/PBImage.d.ts +16 -1
- package/src/cjs/PBImage.js +13 -3
- package/src/cjs/PBImage.js.map +1 -1
- package/src/cjs/PBText.d.ts +130 -0
- package/src/cjs/PBText.js +76 -0
- package/src/cjs/PBText.js.map +1 -0
- package/src/cjs/PlotBoilerplate.d.ts +2 -1
- package/src/cjs/PlotBoilerplate.js +44 -16
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.d.ts +37 -1
- package/src/cjs/Polygon.js +131 -54
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Triangle.d.ts +16 -1
- package/src/cjs/Triangle.js +50 -54
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/VEllipse.d.ts +16 -1
- package/src/cjs/VEllipse.js +25 -12
- package/src/cjs/VEllipse.js.map +1 -1
- package/src/cjs/VEllipseSector.d.ts +15 -1
- package/src/cjs/VEllipseSector.js +11 -1
- package/src/cjs/VEllipseSector.js.map +1 -1
- package/src/cjs/Vector.d.ts +3 -1
- package/src/cjs/Vector.js +32 -36
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/VertTuple.d.ts +15 -1
- package/src/cjs/VertTuple.js +14 -19
- package/src/cjs/VertTuple.js.map +1 -1
- package/src/cjs/Vertex.d.ts +66 -4
- package/src/cjs/Vertex.js +99 -17
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/VertexListeners.d.ts +12 -8
- package/src/cjs/VertexListeners.js +18 -25
- package/src/cjs/VertexListeners.js.map +1 -1
- package/src/cjs/draw.d.ts +30 -2
- package/src/cjs/draw.js +51 -6
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +29 -2
- package/src/cjs/drawgl.js +21 -4
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +25 -7
- package/src/cjs/drawutilssvg.js +62 -14
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/entry.js +1 -0
- package/src/cjs/index.d.ts +1 -0
- package/src/cjs/index.js +1 -0
- package/src/cjs/index.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +27 -6
- package/src/cjs/interfaces/DrawLib.js +3 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +9 -1
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/utils/creategui.js +1 -1
- package/src/cjs/utils/findInVertexArray.d.ts +19 -0
- package/src/cjs/utils/findInVertexArray.js +29 -0
- package/src/cjs/utils/findInVertexArray.js.map +1 -0
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +15 -0
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +55 -28
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/cjs/utils/io/DndFileHandler.d.ts +63 -0
- package/src/cjs/utils/io/DndFileHandler.js +112 -0
- package/src/cjs/utils/io/DndFileHandler.js.map +1 -0
- package/src/cjs/utils/io/FileDrop.d.ts +98 -0
- package/src/cjs/utils/io/FileDrop.js +142 -0
- package/src/cjs/utils/io/FileDrop.js.map +1 -0
- package/src/esm/BezierPath.d.ts +45 -2
- package/src/esm/BezierPath.js +114 -18
- package/src/esm/BezierPath.js.map +1 -1
- package/src/esm/Circle.d.ts +25 -10
- package/src/esm/Circle.js +38 -33
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/CircleSector.d.ts +27 -13
- package/src/esm/CircleSector.js +38 -23
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +17 -1
- package/src/esm/CubicBezierCurve.js +78 -79
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/KeyHandler.d.ts +10 -3
- package/src/esm/KeyHandler.js +28 -23
- package/src/esm/KeyHandler.js.map +1 -1
- package/src/esm/Line.d.ts +2 -1
- package/src/esm/Line.js +19 -18
- package/src/esm/Line.js.map +1 -1
- package/src/esm/MouseHandler.js +43 -53
- package/src/esm/MouseHandler.js.map +1 -1
- package/src/esm/PBImage.d.ts +16 -1
- package/src/esm/PBImage.js +13 -3
- package/src/esm/PBImage.js.map +1 -1
- package/src/esm/PBText.d.ts +130 -0
- package/src/esm/PBText.js +71 -0
- package/src/esm/PBText.js.map +1 -0
- package/src/esm/PlotBoilerplate.d.ts +2 -1
- package/src/esm/PlotBoilerplate.js +44 -16
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.d.ts +37 -1
- package/src/esm/Polygon.js +131 -54
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Triangle.d.ts +16 -1
- package/src/esm/Triangle.js +50 -54
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/VEllipse.d.ts +16 -1
- package/src/esm/VEllipse.js +25 -12
- package/src/esm/VEllipse.js.map +1 -1
- package/src/esm/VEllipseSector.d.ts +15 -1
- package/src/esm/VEllipseSector.js +11 -1
- package/src/esm/VEllipseSector.js.map +1 -1
- package/src/esm/Vector.d.ts +3 -1
- package/src/esm/Vector.js +32 -36
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/VertTuple.d.ts +15 -1
- package/src/esm/VertTuple.js +14 -19
- package/src/esm/VertTuple.js.map +1 -1
- package/src/esm/Vertex.d.ts +66 -4
- package/src/esm/Vertex.js +99 -17
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/VertexListeners.d.ts +12 -8
- package/src/esm/VertexListeners.js +18 -25
- package/src/esm/VertexListeners.js.map +1 -1
- package/src/esm/draw.d.ts +30 -2
- package/src/esm/draw.js +51 -6
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +29 -2
- package/src/esm/drawgl.js +21 -4
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +25 -7
- package/src/esm/drawutilssvg.js +62 -14
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/entry.js +1 -0
- package/src/esm/index.d.ts +1 -0
- package/src/esm/index.js +1 -0
- package/src/esm/index.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +27 -6
- package/src/esm/interfaces/DrawLib.js +3 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +9 -1
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/utils/findInVertexArray.d.ts +19 -0
- package/src/esm/utils/findInVertexArray.js +25 -0
- package/src/esm/utils/findInVertexArray.js.map +1 -0
- package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +15 -0
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js +54 -28
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/esm/utils/io/DndFileHandler.d.ts +63 -0
- package/src/esm/utils/io/DndFileHandler.js +106 -0
- package/src/esm/utils/io/DndFileHandler.js.map +1 -0
- package/src/esm/utils/io/FileDrop.d.ts +98 -0
- package/src/esm/utils/io/FileDrop.js +136 -0
- package/src/esm/utils/io/FileDrop.js.map +1 -0
- package/src/ts/BezierPath.ts +133 -16
- package/src/ts/Circle.ts +213 -200
- package/src/ts/CircleSector.ts +171 -141
- package/src/ts/CubicBezierCurve.ts +777 -810
- package/src/ts/KeyHandler.ts +221 -212
- package/src/ts/Line.ts +77 -80
- package/src/ts/MouseHandler.ts +356 -368
- package/src/ts/PBImage.ts +81 -68
- package/src/ts/PBText.ts +166 -0
- package/src/ts/PlotBoilerplate.ts +48 -20
- package/src/ts/Polygon.ts +519 -451
- package/src/ts/Triangle.ts +484 -489
- package/src/ts/VEllipse.ts +36 -11
- package/src/ts/VEllipseSector.ts +20 -1
- package/src/ts/Vector.ts +164 -160
- package/src/ts/VertTuple.ts +333 -338
- package/src/ts/Vertex.ts +117 -16
- package/src/ts/VertexListeners.ts +248 -266
- package/src/ts/draw.ts +71 -8
- package/src/ts/drawgl.ts +48 -8
- package/src/ts/drawutilssvg.ts +94 -17
- package/src/ts/index.ts +1 -0
- package/src/ts/interfaces/DrawLib.ts +30 -4
- package/src/ts/interfaces/core.ts +9 -0
- package/src/ts/utils/findInVertexArray.ts +28 -0
- package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +61 -30
- package/src/ts/utils/io/FileDrop.ts +178 -0
- package/dist/plotboilerplate.browser.min.js.LICENSE.txt +0 -8
- package/src/ts/utils/algorithms/clearPolygonDuplicateVertices.ts~ +0 -5
- package/src/ts/utils/algorithms/findPolygonSelfIntersections.ts~ +0 -45
- package/src/ts/utils/algorithms/sh-tmp.ts~ +0 -59
- package/src/ts/utils/algorithms/splitPolygonToNonIntersecting.ts~ +0 -113
- package/src/ts/utils/algorithms/sutherlandHodgman.ts~ +0 -88
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDrop.js","sourceRoot":"","sources":["../../../ts/utils/io/FileDrop.ts"],"names":[],"mappings":"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"}
|
package/src/ts/BezierPath.ts
CHANGED
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
* @modified 2020-07-24 Added the getClosestT(Vertex) function.
|
|
21
21
|
* @modified 2020-12-29 Constructor is now private (no explicit use intended).
|
|
22
22
|
* @modified 2021-05-25 Added BezierPath.fromReducedList( Array<number> ).
|
|
23
|
-
* @
|
|
23
|
+
* @modified 2022-01-31 Added `BezierPath.getEvenDistributionVertices(number)`.
|
|
24
|
+
* @modified 2022-02-02 Added the `destroy` method.
|
|
25
|
+
* @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
26
|
+
* @version 2.5.0
|
|
24
27
|
*
|
|
25
28
|
* @file BezierPath
|
|
26
29
|
* @public
|
|
@@ -96,6 +99,14 @@ export class BezierPath implements SVGSerializable {
|
|
|
96
99
|
*/
|
|
97
100
|
bezierCurves: Array<CubicBezierCurve>;
|
|
98
101
|
|
|
102
|
+
/**
|
|
103
|
+
* @member {boolean}
|
|
104
|
+
* @memberof BezierPath
|
|
105
|
+
* @type {boolean}
|
|
106
|
+
* @instance
|
|
107
|
+
*/
|
|
108
|
+
isDestroyed: boolean;
|
|
109
|
+
|
|
99
110
|
// +---------------------------------------------------------------------------------
|
|
100
111
|
// | These constants equal the values from CubicBezierCurve.
|
|
101
112
|
// +-------------------------------
|
|
@@ -529,6 +540,38 @@ export class BezierPath implements SVGSerializable {
|
|
|
529
540
|
return this;
|
|
530
541
|
}
|
|
531
542
|
|
|
543
|
+
/**
|
|
544
|
+
* Scale the whole bezier path by the given uniform factor.
|
|
545
|
+
*
|
|
546
|
+
* @method scale
|
|
547
|
+
* @param {Vertex} anchor - The scale origin to scale from.
|
|
548
|
+
* @param {number} scaleFactor - The scalar to be multiplied with.
|
|
549
|
+
* @instance
|
|
550
|
+
* @memberof BezierPath
|
|
551
|
+
* @return {BezierPath} this for chaining.
|
|
552
|
+
**/
|
|
553
|
+
scale(anchor: Vertex, scaleFactor: number): BezierPath {
|
|
554
|
+
// var scaleFactors : XYCoords = { x : scaleFactor, y : scaleFactor };
|
|
555
|
+
// for (var i = 0; i < this.bezierCurves.length; i++) {
|
|
556
|
+
// var curve = this.bezierCurves[i];
|
|
557
|
+
// curve.getStartPoint().scale(scaleFactor, anchor);
|
|
558
|
+
// curve.getStartControlPoint().scale(scaleFactor, anchor);
|
|
559
|
+
// curve.getEndControlPoint().scale(scaleFactor, anchor);
|
|
560
|
+
// // Do NOT scale the end point here!
|
|
561
|
+
// // Don't forget that the curves are connected and on curve's end point
|
|
562
|
+
// // the the successor's start point (same instance)!
|
|
563
|
+
// }
|
|
564
|
+
|
|
565
|
+
// // Finally move the last end point (was not scaled yet)
|
|
566
|
+
// if (this.bezierCurves.length > 0 && !this.adjustCircular) {
|
|
567
|
+
// this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scale(scaleFactor, anchor);
|
|
568
|
+
// }
|
|
569
|
+
|
|
570
|
+
// this.updateArcLengths();
|
|
571
|
+
// return this;
|
|
572
|
+
return this.scaleXY({ x: scaleFactor, y: scaleFactor }, anchor);
|
|
573
|
+
}
|
|
574
|
+
|
|
532
575
|
/**
|
|
533
576
|
* Scale the whole bezier path by the given (x,y)-factors.
|
|
534
577
|
*
|
|
@@ -539,12 +582,12 @@ export class BezierPath implements SVGSerializable {
|
|
|
539
582
|
* @memberof BezierPath
|
|
540
583
|
* @return {BezierPath} this for chaining.
|
|
541
584
|
**/
|
|
542
|
-
|
|
585
|
+
scaleXY(scaleFactors: XYCoords, anchor?: XYCoords): BezierPath {
|
|
543
586
|
for (var i = 0; i < this.bezierCurves.length; i++) {
|
|
544
587
|
var curve = this.bezierCurves[i];
|
|
545
|
-
curve.getStartPoint().
|
|
546
|
-
curve.getStartControlPoint().
|
|
547
|
-
curve.getEndControlPoint().
|
|
588
|
+
curve.getStartPoint().scaleXY(scaleFactors, anchor);
|
|
589
|
+
curve.getStartControlPoint().scaleXY(scaleFactors, anchor);
|
|
590
|
+
curve.getEndControlPoint().scaleXY(scaleFactors, anchor);
|
|
548
591
|
// Do NOT scale the end point here!
|
|
549
592
|
// Don't forget that the curves are connected and on curve's end point
|
|
550
593
|
// the the successor's start point (same instance)!
|
|
@@ -552,7 +595,7 @@ export class BezierPath implements SVGSerializable {
|
|
|
552
595
|
|
|
553
596
|
// Finally move the last end point (was not scaled yet)
|
|
554
597
|
if (this.bezierCurves.length > 0 && !this.adjustCircular) {
|
|
555
|
-
this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().
|
|
598
|
+
this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scaleXY(scaleFactors, anchor);
|
|
556
599
|
}
|
|
557
600
|
|
|
558
601
|
this.updateArcLengths();
|
|
@@ -1022,6 +1065,64 @@ export class BezierPath implements SVGSerializable {
|
|
|
1022
1065
|
return new Bounds(min, max);
|
|
1023
1066
|
}
|
|
1024
1067
|
|
|
1068
|
+
/**
|
|
1069
|
+
* Get n 'equally' distributed vertices along this Bézier path.
|
|
1070
|
+
*
|
|
1071
|
+
* As the changing curvature of the B slines makes prediction of distances difficult, the
|
|
1072
|
+
* returned vertices' distances are only relatively equal:
|
|
1073
|
+
* - the distance grows where curvature is large.
|
|
1074
|
+
* - the distance shrinks where curvature is small.
|
|
1075
|
+
*
|
|
1076
|
+
* Only the distance mean of all consecutive is 1/n-th of the total arc length.
|
|
1077
|
+
*
|
|
1078
|
+
* Usually this approximation is good enough for most use cases.
|
|
1079
|
+
*
|
|
1080
|
+
* @param {number} pointCount - (must be at least 2) The number of desired points (start and end point included).
|
|
1081
|
+
* @return {Array<Vertex>}
|
|
1082
|
+
*/
|
|
1083
|
+
getEvenDistributionVertices(pointCount: number): Array<Vertex> {
|
|
1084
|
+
if (pointCount < 2) {
|
|
1085
|
+
throw new Error("pointCount must be larger than one; is " + pointCount + ".");
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
const result: Array<Vertex> = [];
|
|
1089
|
+
if (this.bezierCurves.length === 0) {
|
|
1090
|
+
return result;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// Fetch and add the start point from the source polygon
|
|
1094
|
+
var polygonPoint = new Vertex(this.bezierCurves[0].startPoint);
|
|
1095
|
+
result.push(polygonPoint);
|
|
1096
|
+
// if (this.bezierCurves.length === 1) {
|
|
1097
|
+
// return result;
|
|
1098
|
+
// }
|
|
1099
|
+
|
|
1100
|
+
const perimeter: number = this.totalArcLength;
|
|
1101
|
+
const stepSize: number = perimeter / (pointCount - 1);
|
|
1102
|
+
const n: number = this.bezierCurves.length;
|
|
1103
|
+
|
|
1104
|
+
let curveIndex: number = 0;
|
|
1105
|
+
let segmentLength: number = this.bezierCurves[0].arcLength;
|
|
1106
|
+
let curSegmentU: number = stepSize;
|
|
1107
|
+
let i: number = 1;
|
|
1108
|
+
while (i < pointCount && curveIndex < n) {
|
|
1109
|
+
// Check if next eq point is inside this segment
|
|
1110
|
+
if (curSegmentU < segmentLength) {
|
|
1111
|
+
var newPoint = this.bezierCurves[curveIndex].getPoint(curSegmentU);
|
|
1112
|
+
result.push(newPoint);
|
|
1113
|
+
curSegmentU += stepSize;
|
|
1114
|
+
i++;
|
|
1115
|
+
} else {
|
|
1116
|
+
curveIndex++;
|
|
1117
|
+
curSegmentU = curSegmentU - segmentLength;
|
|
1118
|
+
segmentLength = curveIndex < n ? this.bezierCurves[curveIndex].arcLength : 0;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
result.push(new Vertex(this.bezierCurves[n - 1].endPoint));
|
|
1123
|
+
return result;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1025
1126
|
/**
|
|
1026
1127
|
* Clone this BezierPath (deep clone).
|
|
1027
1128
|
*
|
|
@@ -1075,17 +1176,33 @@ export class BezierPath implements SVGSerializable {
|
|
|
1075
1176
|
* @return {string} The SVG string.
|
|
1076
1177
|
**/
|
|
1077
1178
|
toSVGString(options: { className?: string }): string {
|
|
1078
|
-
options = options || {};
|
|
1079
|
-
var buffer: Array<string> = [];
|
|
1080
|
-
buffer.push("<path");
|
|
1081
|
-
if (options.className) buffer.push(' class="' + options.className + '"');
|
|
1082
|
-
buffer.push(' d="');
|
|
1083
|
-
for (var c = 0; c < this.bezierCurves.length; c++) {
|
|
1084
|
-
|
|
1085
|
-
|
|
1179
|
+
// options = options || {};
|
|
1180
|
+
// var buffer: Array<string> = [];
|
|
1181
|
+
// buffer.push("<path");
|
|
1182
|
+
// if (options.className) buffer.push(' class="' + options.className + '"');
|
|
1183
|
+
// buffer.push(' d="');
|
|
1184
|
+
// for (var c = 0; c < this.bezierCurves.length; c++) {
|
|
1185
|
+
// if (c > 0) buffer.push(" ");
|
|
1186
|
+
// buffer.push(this.bezierCurves[c].toSVGPathData());
|
|
1187
|
+
// }
|
|
1188
|
+
// buffer.push('" />');
|
|
1189
|
+
// return buffer.join("");
|
|
1190
|
+
console.warn(
|
|
1191
|
+
"[Deprecation] Warning: the BezierPath.toSVGString method is deprecated and does not return and valid SVG data any more. Please use `drawutilssvg` instead."
|
|
1192
|
+
);
|
|
1193
|
+
return "";
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* This function should invalidate any installed listeners and invalidate this object.
|
|
1198
|
+
* After calling this function the object might not hold valid data any more and
|
|
1199
|
+
* should not be used.
|
|
1200
|
+
*/
|
|
1201
|
+
destroy() {
|
|
1202
|
+
for (var i = 0; i < this.bezierCurves.length; i++) {
|
|
1203
|
+
this.bezierCurves[i].destroy();
|
|
1086
1204
|
}
|
|
1087
|
-
|
|
1088
|
-
return buffer.join("");
|
|
1205
|
+
this.isDestroyed = true;
|
|
1089
1206
|
}
|
|
1090
1207
|
|
|
1091
1208
|
/**
|
package/src/ts/Circle.ts
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* @modified 2020-09-07 Changed the vertAt function by switching sin and cos! The old version did not return the correct vertex (by angle) accoring to the assumed circle math.
|
|
8
8
|
* @modified 2020-10-16 Added the containsCircle(...) function.
|
|
9
9
|
* @modified 2021-01-20 Added UID.
|
|
10
|
-
* @
|
|
10
|
+
* @modified 2022-02-02 Added the `destroy` method.
|
|
11
|
+
* @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
12
|
+
* @version 1.3.0
|
|
11
13
|
**/
|
|
12
14
|
|
|
13
|
-
|
|
14
15
|
import { Line } from "./Line";
|
|
15
16
|
import { UIDGenerator } from "./UIDGenerator";
|
|
16
17
|
import { Vector } from "./Vector";
|
|
@@ -18,214 +19,226 @@ import { VertTuple } from "./VertTuple";
|
|
|
18
19
|
import { Vertex } from "./Vertex";
|
|
19
20
|
import { SVGSerializable, UID } from "./interfaces";
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
/**
|
|
23
23
|
* @classdesc A simple circle: center point and radius.
|
|
24
24
|
*
|
|
25
25
|
* @requires Line
|
|
26
26
|
* @requires Vector
|
|
27
|
-
* @requires VertTuple
|
|
27
|
+
* @requires VertTuple
|
|
28
28
|
* @requires Vertex
|
|
29
29
|
* @requires SVGSerializale
|
|
30
30
|
* @requires UID
|
|
31
31
|
* @requires UIDGenerator
|
|
32
32
|
**/
|
|
33
33
|
export class Circle implements SVGSerializable {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Required to generate proper CSS classes and other class related IDs.
|
|
36
|
+
**/
|
|
37
|
+
readonly className: string = "Circle";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The UID of this drawable object.
|
|
41
|
+
*
|
|
42
|
+
* @member {UID}
|
|
43
|
+
* @memberof Circle
|
|
44
|
+
* @instance
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
readonly uid: UID;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @member {Vertex}
|
|
51
|
+
* @memberof Circle
|
|
52
|
+
* @instance
|
|
53
|
+
*/
|
|
54
|
+
center: Vertex;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @member {number}
|
|
58
|
+
* @memberof Circle
|
|
59
|
+
* @instance
|
|
60
|
+
*/
|
|
61
|
+
radius: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @member isDestroyed
|
|
65
|
+
* @memberof CubicBezierCurve
|
|
66
|
+
* @type {boolean}
|
|
67
|
+
* @instance
|
|
68
|
+
*/
|
|
69
|
+
isDestroyed: boolean;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Create a new circle with given center point and radius.
|
|
73
|
+
*
|
|
74
|
+
* @constructor
|
|
75
|
+
* @name Circle
|
|
76
|
+
* @param {Vertex} center - The center point of the circle.
|
|
77
|
+
* @param {number} radius - The radius of the circle.
|
|
78
|
+
*/
|
|
79
|
+
constructor(center: Vertex, radius: number) {
|
|
80
|
+
this.uid = UIDGenerator.next();
|
|
81
|
+
this.center = center;
|
|
82
|
+
this.radius = radius;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Check if the given circle is fully contained inside this circle.
|
|
87
|
+
*
|
|
88
|
+
* @method containsCircle
|
|
89
|
+
* @param {Circle} circle - The circle to check if it is contained in this circle.
|
|
90
|
+
* @instance
|
|
91
|
+
* @memberof Circle
|
|
92
|
+
* @return {boolean} `true` if any only if the given circle is completely inside this circle.
|
|
93
|
+
*/
|
|
94
|
+
containsCircle(circle: Circle): boolean {
|
|
95
|
+
return this.center.distance(circle.center) + circle.radius < this.radius;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Calculate the distance from this circle to the given line.
|
|
100
|
+
*
|
|
101
|
+
* * If the line does not intersect this ciecle then the returned
|
|
102
|
+
* value will be the minimal distance.
|
|
103
|
+
* * If the line goes through this circle then the returned value
|
|
104
|
+
* will be max inner distance and it will be negative.
|
|
105
|
+
*
|
|
106
|
+
* @method lineDistance
|
|
107
|
+
* @param {Line} line - The line to measure the distance to.
|
|
108
|
+
* @return {number} The minimal distance from the outline of this circle to the given line.
|
|
109
|
+
* @instance
|
|
110
|
+
* @memberof Circle
|
|
111
|
+
*/
|
|
112
|
+
lineDistance(line: VertTuple<any>): number {
|
|
113
|
+
const closestPointOnLine: Vertex = line.getClosestPoint(this.center);
|
|
114
|
+
return closestPointOnLine.distance(this.center) - this.radius;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get the vertex on the this circle for the given angle.
|
|
119
|
+
*
|
|
120
|
+
* @method vertAt
|
|
121
|
+
* @param {number} angle - The angle (in radians) to use.
|
|
122
|
+
* @return {Vertex} The vertex (point) at the given angle.
|
|
123
|
+
* @instance
|
|
124
|
+
* @memberof Circle
|
|
125
|
+
**/
|
|
126
|
+
vertAt(angle: number): Vertex {
|
|
127
|
+
// Find the point on the circle respective the angle. Then move relative to center.
|
|
128
|
+
return Circle.circleUtils.vertAt(angle, this.radius).add(this.center);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get a tangent line of this circle for a given angle.
|
|
133
|
+
*
|
|
134
|
+
* Point a of the returned line is located on the circle, the length equals the radius.
|
|
135
|
+
*
|
|
136
|
+
* @method tangentAt
|
|
137
|
+
* @instance
|
|
138
|
+
* @param {number} angle - The angle (in radians) to use.
|
|
139
|
+
* @return {Line} The tangent line.
|
|
140
|
+
* @memberof Circle
|
|
141
|
+
**/
|
|
142
|
+
tangentAt(angle: number): Vector {
|
|
143
|
+
const pointA: Vertex = Circle.circleUtils.vertAt(angle, this.radius);
|
|
144
|
+
// Construct the perpendicular of the line in point a. Then move relative to center.
|
|
145
|
+
return (new Vector(pointA, new Vertex(0, 0)).add(this.center) as Vector).perp() as Vector;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Calculate the intersection points (if exists) with the given circle.
|
|
150
|
+
*
|
|
151
|
+
* @method circleIntersection
|
|
152
|
+
* @instance
|
|
153
|
+
* @memberof Circle
|
|
154
|
+
* @param {Circle} circle
|
|
155
|
+
* @return {Line|null} The intersection points (as a line) or null if the two circles do not intersect.
|
|
156
|
+
**/
|
|
157
|
+
circleIntersection(circle: Circle): Line | null {
|
|
158
|
+
// Circles do not intersect at all?
|
|
159
|
+
if (this.center.distance(circle.center) > this.radius + circle.radius) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
// One circle is fully inside the other?
|
|
163
|
+
if (this.center.distance(circle.center) < Math.abs(this.radius - circle.radius)) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
// Based on the C++ implementation by Robert King
|
|
167
|
+
// https://stackoverflow.com/questions/3349125/circle-circle-intersection-points
|
|
168
|
+
// and the 'Circles and spheres' article by Paul Bourke.
|
|
169
|
+
// http://paulbourke.net/geometry/circlesphere/
|
|
170
|
+
//
|
|
171
|
+
// This is the original C++ implementation:
|
|
172
|
+
//
|
|
173
|
+
// pair<Point, Point> intersections(Circle c) {
|
|
174
|
+
// Point P0(x, y);
|
|
175
|
+
// Point P1(c.x, c.y);
|
|
176
|
+
// float d, a, h;
|
|
177
|
+
// d = P0.distance(P1);
|
|
178
|
+
// a = (r*r - c.r*c.r + d*d)/(2*d);
|
|
179
|
+
// h = sqrt(r*r - a*a);
|
|
180
|
+
// Point P2 = P1.sub(P0).scale(a/d).add(P0);
|
|
181
|
+
// float x3, y3, x4, y4;
|
|
182
|
+
// x3 = P2.x + h*(P1.y - P0.y)/d;
|
|
183
|
+
// y3 = P2.y - h*(P1.x - P0.x)/d;
|
|
184
|
+
// x4 = P2.x - h*(P1.y - P0.y)/d;
|
|
185
|
+
// y4 = P2.y + h*(P1.x - P0.x)/d;
|
|
186
|
+
// return pair<Point, Point>(Point(x3, y3), Point(x4, y4));
|
|
187
|
+
// }
|
|
188
|
+
var p0 = this.center;
|
|
189
|
+
var p1 = circle.center;
|
|
190
|
+
var d = p0.distance(p1);
|
|
191
|
+
var a = (this.radius * this.radius - circle.radius * circle.radius + d * d) / (2 * d);
|
|
192
|
+
var h = Math.sqrt(this.radius * this.radius - a * a);
|
|
193
|
+
var p2 = p1.clone().scale(a / d, p0);
|
|
194
|
+
var x3 = p2.x + (h * (p1.y - p0.y)) / d;
|
|
195
|
+
var y3 = p2.y - (h * (p1.x - p0.x)) / d;
|
|
196
|
+
var x4 = p2.x - (h * (p1.y - p0.y)) / d;
|
|
197
|
+
var y4 = p2.y + (h * (p1.x - p0.x)) / d;
|
|
198
|
+
return new Line(new Vertex(x3, y3), new Vertex(x4, y4));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Create an SVG representation of this circle.
|
|
203
|
+
*
|
|
204
|
+
* @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.
|
|
205
|
+
* @method toSVGString
|
|
206
|
+
* @param {object=} options - An optional set of options, like 'className'.
|
|
207
|
+
* @return {string} A string representing the SVG code for this vertex.
|
|
208
|
+
* @instance
|
|
209
|
+
* @memberof Circle
|
|
210
|
+
*/
|
|
211
|
+
toSVGString(options: { className?: string }) {
|
|
212
|
+
// options = options || {};
|
|
213
|
+
// var buffer: Array<string> = [];
|
|
214
|
+
// buffer.push("<circle");
|
|
215
|
+
// if (options.className) buffer.push(' class="' + options.className + '"');
|
|
216
|
+
// buffer.push(' cx="' + this.center.x + '"');
|
|
217
|
+
// buffer.push(' cy="' + this.center.y + '"');
|
|
218
|
+
// buffer.push(' r="' + this.radius + '"');
|
|
219
|
+
// buffer.push(" />");
|
|
220
|
+
// return buffer.join("");
|
|
221
|
+
console.warn(
|
|
222
|
+
"[Deprecation] Warning: the Circle.toSVGString method is deprecated and does not return and valid SVG data any more. Please use `drawutilssvg` instead."
|
|
223
|
+
);
|
|
224
|
+
return "";
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* This function should invalidate any installed listeners and invalidate this object.
|
|
229
|
+
* After calling this function the object might not hold valid data any more and
|
|
230
|
+
* should not be used.
|
|
231
|
+
*/
|
|
232
|
+
destroy() {
|
|
233
|
+
this.center.destroy();
|
|
234
|
+
this.isDestroyed = true;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
static circleUtils = {
|
|
238
|
+
vertAt: (angle: number, radius: number) => {
|
|
239
|
+
/* return new Vertex( Math.sin(angle) * radius,
|
|
225
240
|
Math.cos(angle) * radius ); */
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
};
|
|
230
|
-
|
|
241
|
+
return new Vertex(Math.cos(angle) * radius, Math.sin(angle) * radius);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
231
244
|
} // END class
|