1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
|
| /**
| * points:[
| {x:-100,y:1,z:50},
| {x:-500,y:1,z:50},
| {x:-800,y:1,z:50},
| {x:-800,y:1,z:420},
| {x:-1400,y:1,z:420},
| {x:-1400,y:1,z:480},
| {x:-100,y:1,z:480},
| {x:-100,y:1,z:50}
| ]
| */
| function Route(option) {
| let curvePoints=[];
| // 1.去取货 ------------------------------------------------------------------------
| // z轴
| // curvePoints.push(option[0]);
| // curvePoints.push(
| // new THREE.Vector3(
| // option[0].x,
| // option[0].y,
| // option[1].z/2
| // )
| // );
| // curvePoints.push(
| // new THREE.Vector3(
| // option[0].x,
| // option[0].y,
| // option[1].z
| // )
| // );
| // return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001);
|
|
| // return new THREE.LineCurve3(option[0],new THREE.Vector3(
| // option[0].x,
| // option[0].y,
| // option[1].z
| // ));
|
| for (let i = 0;i<option.length;i++) {
| curvePoints.push(
| new THREE.Vector3(
| option[i].x,
| option[i].y,
| option[i].z
| )
| );
| }
| return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001);
|
|
|
| // 2.
|
|
| // let curvePoints=[];
| // for(let i=0;i<option.points.length;i++) {
| // let point=option.points[i];
| // curvePoints.push(new THREE.Vector3(point.x, point.y, point.z));
| // }
| // return new THREE.CatmullRomCurve3(curvePoints,false/*是否闭合*/,'catmullrom',0.000000001);
| }
|
|