poly-extrude 0.1.0 → 0.3.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/dist/poly-extrude.js +1983 -10
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +2 -2
- package/dist/poly-extrude.mjs +1983 -11
- package/index.js +2 -1
- package/package.json +1 -1
- package/readme.md +191 -36
- package/src/math/Curve.js +415 -0
- package/src/math/Interpolations.js +80 -0
- package/src/math/Matrix4.js +914 -0
- package/src/math/QuadraticBezierCurve3.js +76 -0
- package/src/math/Vector3.js +711 -0
- package/src/path/PathPoint.js +41 -0
- package/src/path/PathPointList.js +251 -0
- package/src/path.js +259 -0
- package/src/polyline.js +10 -9
@@ -0,0 +1,76 @@
|
|
1
|
+
// code copy from https://github.com/mrdoob/three.js/blob/dev/src/extras/curves/QuadraticBezierCurve3.js
|
2
|
+
import { Curve } from './Curve.js';
|
3
|
+
import { QuadraticBezier } from './Interpolations.js';
|
4
|
+
import { Vector3 } from './Vector3.js';
|
5
|
+
|
6
|
+
class QuadraticBezierCurve3 extends Curve {
|
7
|
+
|
8
|
+
constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) {
|
9
|
+
|
10
|
+
super();
|
11
|
+
|
12
|
+
this.isQuadraticBezierCurve3 = true;
|
13
|
+
|
14
|
+
this.type = 'QuadraticBezierCurve3';
|
15
|
+
|
16
|
+
this.v0 = v0;
|
17
|
+
this.v1 = v1;
|
18
|
+
this.v2 = v2;
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
getPoint(t, optionalTarget = new Vector3()) {
|
23
|
+
|
24
|
+
const point = optionalTarget;
|
25
|
+
|
26
|
+
const v0 = this.v0, v1 = this.v1, v2 = this.v2;
|
27
|
+
|
28
|
+
point.set(
|
29
|
+
QuadraticBezier(t, v0.x, v1.x, v2.x),
|
30
|
+
QuadraticBezier(t, v0.y, v1.y, v2.y),
|
31
|
+
QuadraticBezier(t, v0.z, v1.z, v2.z)
|
32
|
+
);
|
33
|
+
|
34
|
+
return point;
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
// copy(source) {
|
39
|
+
|
40
|
+
// super.copy(source);
|
41
|
+
|
42
|
+
// this.v0.copy(source.v0);
|
43
|
+
// this.v1.copy(source.v1);
|
44
|
+
// this.v2.copy(source.v2);
|
45
|
+
|
46
|
+
// return this;
|
47
|
+
|
48
|
+
// }
|
49
|
+
|
50
|
+
// toJSON() {
|
51
|
+
|
52
|
+
// const data = super.toJSON();
|
53
|
+
|
54
|
+
// data.v0 = this.v0.toArray();
|
55
|
+
// data.v1 = this.v1.toArray();
|
56
|
+
// data.v2 = this.v2.toArray();
|
57
|
+
|
58
|
+
// return data;
|
59
|
+
|
60
|
+
// }
|
61
|
+
|
62
|
+
// fromJSON(json) {
|
63
|
+
|
64
|
+
// super.fromJSON(json);
|
65
|
+
|
66
|
+
// this.v0.fromArray(json.v0);
|
67
|
+
// this.v1.fromArray(json.v1);
|
68
|
+
// this.v2.fromArray(json.v2);
|
69
|
+
|
70
|
+
// return this;
|
71
|
+
|
72
|
+
// }
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
export { QuadraticBezierCurve3 };
|