poly-extrude 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 };