#
luxiaotao1123
2022-06-22 03421f49b51b92f675d0bd0cae9d0ba341001b92
static/js/object/Route.js
@@ -1,3 +1,4 @@
/**
 *  points:[
     {x:-100,y:1,z:50},
@@ -12,9 +13,52 @@
 */
function Route(option) {
    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));
    // 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/*是否闭合*/,'catmullrom',0.000000001);
    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);
}