dgeoutils 2.2.16 → 2.2.17
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/dist/DPolygon.d.ts +1 -0
- package/dist/DPolygon.js +14 -0
- package/package.json +1 -1
package/dist/DPolygon.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export declare class DPolygon {
|
|
|
102
102
|
get closed(): boolean;
|
|
103
103
|
buffer(v: number, quadrantSegments?: number, type?: number): DPolygon;
|
|
104
104
|
bezier(step?: number): DPolygon;
|
|
105
|
+
setGrowingHeight(from: number, to: number): DPolygon;
|
|
105
106
|
private getBezierPoint;
|
|
106
107
|
private simpleIncludeX;
|
|
107
108
|
private simpleIncludeY;
|
package/dist/DPolygon.js
CHANGED
|
@@ -815,6 +815,20 @@ class DPolygon {
|
|
|
815
815
|
}
|
|
816
816
|
return res;
|
|
817
817
|
}
|
|
818
|
+
setGrowingHeight(from, to) {
|
|
819
|
+
const { fullLength } = this;
|
|
820
|
+
let { first: prevPoint } = this;
|
|
821
|
+
const d = to - from;
|
|
822
|
+
let currentDistance = 0;
|
|
823
|
+
this.loop()
|
|
824
|
+
.setZ((p) => {
|
|
825
|
+
currentDistance += prevPoint.distance(p);
|
|
826
|
+
prevPoint = p;
|
|
827
|
+
return from + currentDistance / fullLength * d;
|
|
828
|
+
})
|
|
829
|
+
.run();
|
|
830
|
+
return this;
|
|
831
|
+
}
|
|
818
832
|
getBezierPoint(v) {
|
|
819
833
|
if (this.length === 1) {
|
|
820
834
|
return this.first;
|