|
@@ -62,12 +62,12 @@ export default {
|
|
|
group2: null,
|
|
|
r: 15,
|
|
|
r1: 6,
|
|
|
- horizontal: 120,
|
|
|
- vertical: 90,
|
|
|
- horizontalL: 100,
|
|
|
- horizontalR: 60,
|
|
|
- verticalT: 30,
|
|
|
- verticalB: 30,
|
|
|
+ horizontal: 240,
|
|
|
+ vertical: 30,
|
|
|
+ horizontalL: 150,
|
|
|
+ horizontalR: 120,
|
|
|
+ verticalT: 120,
|
|
|
+ verticalB: 120,
|
|
|
a1: null,
|
|
|
b1: null,
|
|
|
c1: null,
|
|
@@ -635,7 +635,7 @@ export default {
|
|
|
|
|
|
},
|
|
|
initLeft() {
|
|
|
- let horizontal = this.horizontal;
|
|
|
+ let horizontal = this.horizontal / 2;
|
|
|
|
|
|
if (horizontal % 90 === 0) horizontal = horizontal - 0.1;
|
|
|
|
|
@@ -758,6 +758,64 @@ export default {
|
|
|
this.b1 = new ThreeBSP(circle1);
|
|
|
this.c1 = new ThreeBSP(circle2);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ let h = Math.sin(THREE.MathUtils.degToRad(this.vertical)) * this.r,
|
|
|
+ r1 = Math.cos(THREE.MathUtils.degToRad(this.vertical)) * this.r;
|
|
|
+
|
|
|
+ const cone1 = new THREE.ConeGeometry(
|
|
|
+ r1, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+
|
|
|
+ cone1.translate(0, -h / 2, 0);
|
|
|
+ cone1.rotateX(Math.PI * 1);
|
|
|
+
|
|
|
+ const cone2 = new THREE.ConeGeometry(
|
|
|
+ r1, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+ cone2.translate(0, -h / 2, 0);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const circle01 = new THREE.CircleGeometry(h * 0.1, 32);
|
|
|
+ circle01.rotateX(Math.PI * 0.5);
|
|
|
+ circle01.translate(0, h, 0);
|
|
|
+
|
|
|
+ const circle02 = new THREE.CircleGeometry(h * 0.1, 32);
|
|
|
+ circle02.rotateX(Math.PI * 0.5);
|
|
|
+ circle02.translate(0, -h, 0);
|
|
|
+
|
|
|
+
|
|
|
+ this.x1 = new ThreeBSP(circle01); // up
|
|
|
+ this.y1 = new ThreeBSP(cone1);
|
|
|
+ this.x2 = new ThreeBSP(circle02); // down
|
|
|
+ this.y2 = new ThreeBSP(cone2);
|
|
|
+
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ 2, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+ this.z1 = new ThreeBSP(sphere1);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/* var m = new THREE.MeshBasicMaterial({ color: 0xff00ff, side: THREE.DoubleSide });
|
|
|
// const resultBSP = a.subtract(b);
|
|
|
const resultBSP = a.subtract(b).subtract(c).toMesh(m);
|
|
@@ -1381,6 +1439,221 @@ export default {
|
|
|
this.z2 = new ThreeBSP(circle2);
|
|
|
this.w2 = new ThreeBSP(sphere0);
|
|
|
},
|
|
|
+ init1Ogt0() {
|
|
|
+ const cylinder = new THREE.CylinderGeometry(
|
|
|
+ 20, // radiusTop — 圆柱的顶部半径,默认值是1
|
|
|
+ 20, // radiusBottom — 圆柱的底部半径,默认值是1
|
|
|
+ 16, // height — 圆柱的高度,默认值是1
|
|
|
+ 32, // radialSegments — 圆柱侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆柱侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆柱底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆柱
|
|
|
+ );
|
|
|
+
|
|
|
+ // cylinder.rotateY(Math.PI * -0.75);
|
|
|
+
|
|
|
+ const material1 = new THREE.MeshBasicMaterial({ color: 0xffff00, side: THREE.DoubleSide, transparent: true, opacity: 0.3, });
|
|
|
+ const material = new THREE.MeshBasicMaterial({ color: 0xff00ff, side: THREE.DoubleSide, transparent: true, opacity: 0.3, });
|
|
|
+ const cylinderMesh = new THREE.Mesh(cylinder, material1);
|
|
|
+ // this.scene.add(cylinderMesh);
|
|
|
+
|
|
|
+ const cylinder1 = new THREE.CylinderGeometry(
|
|
|
+ 20, // radiusTop — 圆柱的顶部半径,默认值是1
|
|
|
+ 20, // radiusBottom — 圆柱的底部半径,默认值是1
|
|
|
+ 16, // height — 圆柱的高度,默认值是1
|
|
|
+ 32, // radialSegments — 圆柱侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆柱侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 0.5 * Math.PI, // thetaLength — 圆柱底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆柱
|
|
|
+ );
|
|
|
+ cylinder1.rotateY(Math.PI * 0.75);
|
|
|
+ const cylinderMesh1 = new THREE.Mesh(cylinder1, material1);
|
|
|
+ // this.scene.add(cylinderMesh1);
|
|
|
+
|
|
|
+
|
|
|
+ const plane1 = new THREE.PlaneGeometry(20, 16);
|
|
|
+ // plane1.rotateY(Math.PI * -0.75);
|
|
|
+ // plane1.rotateY(Math.PI * -0.5);
|
|
|
+ plane1.translate(10, 0, 0);
|
|
|
+ plane1.rotateY(Math.PI * 0.25);
|
|
|
+ const planeMesh1 = new THREE.Mesh(plane1, material);
|
|
|
+ // this.scene.add(planeMesh1);
|
|
|
+
|
|
|
+ const plane2 = new THREE.PlaneGeometry(20, 16);
|
|
|
+ plane2.translate(10, 0, 0);
|
|
|
+ plane2.rotateY(Math.PI * 0.75);
|
|
|
+ const planeMesh2 = new THREE.Mesh(plane2, material);
|
|
|
+ // this.scene.add(planeMesh2);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let h = Math.sin(THREE.MathUtils.degToRad(60)) * 15;
|
|
|
+
|
|
|
+ const cone1 = new THREE.ConeGeometry(
|
|
|
+ 20, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+
|
|
|
+ cone1.translate(0, -h / 2, 0);
|
|
|
+ cone1.rotateX(Math.PI * 1);
|
|
|
+ const coneMesh1 = new THREE.Mesh(cone1, material);
|
|
|
+ // this.scene.add(coneMesh1); // 上
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let h1 = Math.sin(THREE.MathUtils.degToRad(30)) * 15;
|
|
|
+
|
|
|
+ const cone2 = new THREE.ConeGeometry(
|
|
|
+ 20, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h1, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+ cone2.translate(0, -h1 / 2, 0);
|
|
|
+
|
|
|
+ const coneMesh2 = new THREE.Mesh(cone2, material);
|
|
|
+ // this.scene.add(coneMesh2); // 下
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // this.a1 = new ThreeBSP(cylinder);
|
|
|
+ // this.a2 = new ThreeBSP(cylinder1);
|
|
|
+ // this.b1 = new ThreeBSP(plane1);
|
|
|
+ // this.c1 = new ThreeBSP(plane2);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const sphere = new THREE.SphereGeometry(
|
|
|
+ 20, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+ const sphereMesh = new THREE.Mesh(sphere, material1);
|
|
|
+ // this.scene.add(sphereMesh);
|
|
|
+
|
|
|
+ const circle1 = new THREE.CircleGeometry(h * 0.1, 32);
|
|
|
+ circle1.rotateX(Math.PI * 0.5);
|
|
|
+ circle1.translate(0, h, 0);
|
|
|
+
|
|
|
+ const circle2 = new THREE.CircleGeometry(h1 * 0.1, 32);
|
|
|
+ circle2.rotateX(Math.PI * 0.5);
|
|
|
+ circle2.translate(0, -h1, 0);
|
|
|
+
|
|
|
+ // this.a1 = new ThreeBSP(sphere);
|
|
|
+ this.x1 = new ThreeBSP(circle1); // up
|
|
|
+ this.y1 = new ThreeBSP(cone1);
|
|
|
+ this.x2 = new ThreeBSP(circle2); // down
|
|
|
+ this.y2 = new ThreeBSP(cone2);
|
|
|
+ // this.b1 = new ThreeBSP(circle1);
|
|
|
+ // this.c1 = new ThreeBSP(circle2);
|
|
|
+
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ 2, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+ this.z1 = new ThreeBSP(sphere1);
|
|
|
+ },
|
|
|
+ init1Ogt() {
|
|
|
+ let hl = 60,
|
|
|
+ hr = 150
|
|
|
+
|
|
|
+ let r = 20,
|
|
|
+ thetaLength = Math.PI * (hl / 180),
|
|
|
+ thetaLength1 = Math.PI * (hr / 180)
|
|
|
+
|
|
|
+ const cylinder = new THREE.CylinderGeometry(
|
|
|
+ r, // radiusTop — 圆柱的顶部半径,默认值是1
|
|
|
+ r, // radiusBottom — 圆柱的底部半径,默认值是1
|
|
|
+ r, // height — 圆柱的高度,默认值是1
|
|
|
+ 32, // radialSegments — 圆柱侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆柱侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ thetaLength, // thetaLength — 圆柱底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆柱
|
|
|
+ );
|
|
|
+
|
|
|
+ const material1 = new THREE.MeshBasicMaterial({ color: 0xffff00, wireframe: true, side: THREE.DoubleSide, transparent: true, opacity: 0.3, });
|
|
|
+ const material = new THREE.MeshBasicMaterial({ color: 0xff00ff, wireframe: true, side: THREE.DoubleSide, transparent: true, opacity: 0.3, });
|
|
|
+ const cylinderMesh = new THREE.Mesh(cylinder, material1);
|
|
|
+ // this.scene.add(cylinderMesh);
|
|
|
+
|
|
|
+ const plane1 = new THREE.PlaneGeometry(r, r);
|
|
|
+ plane1.rotateY(Math.PI * 0.5);
|
|
|
+ plane1.translate(0, 0, r / 2);
|
|
|
+ const planeMesh1 = new THREE.Mesh(plane1, material);
|
|
|
+ // this.scene.add(planeMesh1);
|
|
|
+
|
|
|
+ const plane2 = new THREE.PlaneGeometry(r, r);
|
|
|
+ plane2.translate(r / 2, 0, 0);
|
|
|
+ plane2.rotateY(Math.PI * ((hl - 90) / 180));
|
|
|
+ const planeMesh2 = new THREE.Mesh(plane2, material);
|
|
|
+ // this.scene.add(planeMesh2);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const cylinder1 = new THREE.CylinderGeometry(
|
|
|
+ r, // radiusTop — 圆柱的顶部半径,默认值是1
|
|
|
+ r, // radiusBottom — 圆柱的底部半径,默认值是1
|
|
|
+ r, // height — 圆柱的高度,默认值是1
|
|
|
+ 32, // radialSegments — 圆柱侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆柱侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ thetaLength1, // thetaLength — 圆柱底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆柱
|
|
|
+ );
|
|
|
+ cylinder1.rotateY(-thetaLength1);
|
|
|
+
|
|
|
+ const cylinderMesh1 = new THREE.Mesh(cylinder1, material1);
|
|
|
+ // this.scene.add(cylinderMesh1);
|
|
|
+
|
|
|
+ const plane3 = new THREE.PlaneGeometry(r, r);
|
|
|
+ plane3.rotateY(Math.PI * 0.5);
|
|
|
+ plane3.translate(0, 0, r / 2);
|
|
|
+ const planeMesh3 = new THREE.Mesh(plane3, material);
|
|
|
+ // this.scene.add(planeMesh3);
|
|
|
+
|
|
|
+ const plane4 = new THREE.PlaneGeometry(r, r);
|
|
|
+ plane4.translate(-r / 2, 0, 0);
|
|
|
+ plane4.rotateY(Math.PI * ((90 - hr) / 180));
|
|
|
+ const planeMesh4 = new THREE.Mesh(plane4, material);
|
|
|
+ // this.scene.add(planeMesh4);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.a1 = new ThreeBSP(cylinder);
|
|
|
+ this.b1 = new ThreeBSP(plane1);
|
|
|
+ this.c1 = new ThreeBSP(plane2);
|
|
|
+ this.a2 = new ThreeBSP(cylinder1);
|
|
|
+ this.b2 = new ThreeBSP(plane3);
|
|
|
+ this.c2 = new ThreeBSP(plane4);
|
|
|
+
|
|
|
+ },
|
|
|
initMesh(pointsArr) {
|
|
|
/* let points = pointsArr.map(
|
|
|
(d) => new THREE.Vector3(d[0], d[1], d[2])
|
|
@@ -1416,7 +1689,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
- // this.initLeft();
|
|
|
+ this.initLeft();
|
|
|
// this.initTop();
|
|
|
|
|
|
|
|
@@ -1429,15 +1702,24 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
- this.initOgtDemo();
|
|
|
- this.initOgtDemo1();
|
|
|
+
|
|
|
+ // this.initOgtDemo();
|
|
|
+ // this.initOgtDemo1();
|
|
|
+
|
|
|
+
|
|
|
+ // this.initOgt();
|
|
|
+ // this.initOgt1();
|
|
|
+
|
|
|
+ // this.initOgt0();
|
|
|
+ // this.initOgt01();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // this.init1Ogt0();
|
|
|
+ // this.init1Ogt();
|
|
|
|
|
|
|
|
|
- this.initOgt();
|
|
|
- this.initOgt1();
|
|
|
|
|
|
- this.initOgt0();
|
|
|
- this.initOgt01();
|
|
|
|
|
|
// console.log(this.group1);
|
|
|
|
|
@@ -1465,9 +1747,10 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
- var m = new THREE.MeshBasicMaterial({ color: 0xff00ff, side: THREE.DoubleSide });
|
|
|
+ // var m = new THREE.MeshBasicMaterial({ color: 0xff00ff, side: THREE.DoubleSide });
|
|
|
+ // let m = new THREE.MeshPhongMaterial({ emissive: 0xff00ff, color: 0x4c4c4c, transparent: true, opacity: 0.3, side: THREE.DoubleSide });
|
|
|
// var m = new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending });
|
|
|
- // var m = new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } );
|
|
|
+ var m = new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true });
|
|
|
|
|
|
|
|
|
// let m = new THREE.MeshPhongMaterial({
|
|
@@ -1603,6 +1886,43 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+ // ogt new
|
|
|
+ // ogt 左右相加大于180 上下相加小于180
|
|
|
+ // const resultBSP = this.a2.intersect(this.b2.subtract(this.c2))
|
|
|
+ // const resultBSP = this.a1.subtract(this.b1).subtract(this.c1)
|
|
|
+ // .union(this.a2.intersect(this.b2.subtract(this.c2)))
|
|
|
+ // .subtract(this.x1).subtract(this.y1)
|
|
|
+ // .toMesh(m);
|
|
|
+ // const resultBSP = this.a1.toMesh(m);
|
|
|
+
|
|
|
+ // const resultBSP = this.a1.subtract(this.b1).subtract(this.x1).intersect(this.c1).subtract(this.y1).toMesh(m);
|
|
|
+ // 大于180
|
|
|
+ // const resultBSP = this.a1.intersect(this.d1).subtract(this.b1.intersect(this.c1)).subtract(this.y1).subtract(this.x1).toMesh(m);
|
|
|
+ // const resultBSP = this.a1.intersect(this.d1).subtract(this.b1.intersect(this.c1))
|
|
|
+ // .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2).subtract(this.z1)
|
|
|
+ // .toMesh(m);
|
|
|
+ // 小于180
|
|
|
+ // const resultBSP = this.y2
|
|
|
+ // const resultBSP = this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1)
|
|
|
+ // .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2).subtract(this.z1)
|
|
|
+ // .toMesh(m);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 非ogt new
|
|
|
+ // 都小于90
|
|
|
+ // const resultBSP = this.a1.subtract(this.b1).subtract(this.c1)
|
|
|
+ // .toMesh(m);
|
|
|
+ // 大于90
|
|
|
+ const resultBSP = this.a1.subtract(this.b1.intersect(this.c1))
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2).subtract(this.z1)
|
|
|
+ // .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// const resultBSP = this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1).toMesh(m);
|
|
|
|
|
|
|
|
@@ -1626,13 +1946,15 @@ export default {
|
|
|
// .subtract(this.x1.intersect(this.w1).subtract(this.y1).subtract(this.z1).intersect(this.x2.intersect(this.w2).subtract(this.y2).intersect(this.z2)))
|
|
|
// .toMesh(m);
|
|
|
|
|
|
- const resultBSP =
|
|
|
- this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1)
|
|
|
- .toMesh(m);
|
|
|
+ // const resultBSP =
|
|
|
+ // this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1)
|
|
|
+ // .toMesh(m);
|
|
|
+
|
|
|
|
|
|
|
|
|
// console.log(resultBSP);
|
|
|
- this.scene.add(resultBSP);
|
|
|
+ // console.log('resultBSP');
|
|
|
+ // this.scene.add(resultBSP);
|
|
|
|
|
|
|
|
|
/*
|
|
@@ -1687,23 +2009,23 @@ export default {
|
|
|
|
|
|
if (vh === 'v') {
|
|
|
deg = coordinate.fovV;
|
|
|
- if (coordinate.fovH >= 47 && coordinate.fovH <= 53 && coordinate.fovV == 30) {
|
|
|
- deg = 31;
|
|
|
- }
|
|
|
+ // if (coordinate.fovH >= 47 && coordinate.fovH <= 53 && coordinate.fovV == 30) {
|
|
|
+ // deg = 31;
|
|
|
+ // }
|
|
|
|
|
|
- if (deg == 80) deg = 79;
|
|
|
- if (deg == 20) deg = 19;
|
|
|
- if (deg % 10 === 0 && deg % 90 != 0) deg = deg + 0.7;
|
|
|
+ // if (deg == 80) deg = 79;
|
|
|
+ // if (deg == 20) deg = 19;
|
|
|
+ // if (deg % 10 === 0 && deg % 90 != 0) deg = deg + 0.7;
|
|
|
} else {
|
|
|
- deg = coordinate.fovH;
|
|
|
- if (deg >= 47 && deg <= 53) deg = 53;
|
|
|
- if (deg >= 17 && deg <= 23) deg = 17;
|
|
|
- if (deg >= 117 && deg <= 123) deg = 121;
|
|
|
- if (deg >= 147 && deg <= 153) deg = 148;
|
|
|
+ deg = coordinate.fovH / 2;
|
|
|
+ // if (deg >= 47 && deg <= 53) deg = 53;
|
|
|
+ // if (deg >= 17 && deg <= 23) deg = 17;
|
|
|
+ // if (deg >= 117 && deg <= 123) deg = 121;
|
|
|
+ // if (deg >= 147 && deg <= 153) deg = 148;
|
|
|
}
|
|
|
|
|
|
// 180°时融合有问题
|
|
|
- if (deg % 90 === 0) deg = deg - 0.5;
|
|
|
+ // if (deg % 90 === 0) deg = deg - 0.5;
|
|
|
|
|
|
|
|
|
let phiStart = Math.PI * ((90 - deg) / 180),
|
|
@@ -1775,6 +2097,85 @@ export default {
|
|
|
this.c1 = new ThreeBSP(circle2);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if (deg >= 360) {
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ r, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+
|
|
|
+ this.a1 = new ThreeBSP(sphere1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initContent01(coordinate) {
|
|
|
+ let far = coordinate.farDistance,
|
|
|
+ near = coordinate.nearDistance,
|
|
|
+ fovV = coordinate.fovV / 2;
|
|
|
+
|
|
|
+ if (fovV >= 90) fovV = 89.9;
|
|
|
+
|
|
|
+ let h = Math.sin(THREE.MathUtils.degToRad(fovV)) * far,
|
|
|
+ r1 = Math.cos(THREE.MathUtils.degToRad(fovV)) * far;
|
|
|
+
|
|
|
+ const cone1 = new THREE.ConeGeometry(
|
|
|
+ r1, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+
|
|
|
+ cone1.translate(0, -h / 2, 0);
|
|
|
+ cone1.rotateX(Math.PI * 1);
|
|
|
+
|
|
|
+ const cone2 = new THREE.ConeGeometry(
|
|
|
+ r1, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+ cone2.translate(0, -h / 2, 0);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const circle01 = new THREE.CircleGeometry(h * 0.1, 32);
|
|
|
+ circle01.rotateX(Math.PI * 0.5);
|
|
|
+ circle01.translate(0, h, 0);
|
|
|
+
|
|
|
+ const circle02 = new THREE.CircleGeometry(h * 0.1, 32);
|
|
|
+ circle02.rotateX(Math.PI * 0.5);
|
|
|
+ circle02.translate(0, -h, 0);
|
|
|
+
|
|
|
+
|
|
|
+ if (near > 0) {
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ near, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+ this.z1 = new ThreeBSP(sphere1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.x1 = new ThreeBSP(circle01); // up
|
|
|
+ this.y1 = new ThreeBSP(cone1);
|
|
|
+ this.x2 = new ThreeBSP(circle02); // down
|
|
|
+ this.y2 = new ThreeBSP(cone2);
|
|
|
},
|
|
|
/**
|
|
|
* 初始化ogt模型
|
|
@@ -1814,14 +2215,17 @@ export default {
|
|
|
deg1 = coordinate.fovHLeft;
|
|
|
}
|
|
|
|
|
|
+ if (deg == 0) deg = 1
|
|
|
+ if (deg1 == 0) deg1 = 1
|
|
|
+
|
|
|
// 180°时融合有问题
|
|
|
- if ((deg + deg1) % 180 === 0) {
|
|
|
- if (deg > 1) {
|
|
|
- deg = deg - 0.1;
|
|
|
- } else {
|
|
|
- deg1 = deg1 - 0.1;
|
|
|
- }
|
|
|
- }
|
|
|
+ // if ((deg + deg1) % 180 === 0) {
|
|
|
+ // if (deg > 1) {
|
|
|
+ // deg = deg - 0.1;
|
|
|
+ // } else {
|
|
|
+ // deg1 = deg1 - 0.1;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
let phiStart = Math.PI * ((90 - deg) / 180),
|
|
@@ -1924,6 +2328,89 @@ export default {
|
|
|
this.d1 = new ThreeBSP(sphere0);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (deg + deg1 >= 360) {
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ r, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+
|
|
|
+ this.a1 = new ThreeBSP(sphere1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initContentOgt1(coordinate) {
|
|
|
+ let far = coordinate.farDistance,
|
|
|
+ near = coordinate.nearDistance,
|
|
|
+ fv = coordinate.fovVTop,
|
|
|
+ fb = coordinate.fovVBottom;
|
|
|
+
|
|
|
+ if (fv >= 90) fv = 89.9
|
|
|
+ if (fb >= 90) fb = 89.9
|
|
|
+
|
|
|
+ let r = Math.cos(THREE.MathUtils.degToRad(fv)) * far,
|
|
|
+ h = Math.sin(THREE.MathUtils.degToRad(fv)) * far,
|
|
|
+ r1 = Math.cos(THREE.MathUtils.degToRad(fb)) * far,
|
|
|
+ h1 = Math.sin(THREE.MathUtils.degToRad(fb)) * far
|
|
|
+
|
|
|
+ // 上方圆锥
|
|
|
+ const cone1 = new THREE.ConeGeometry(
|
|
|
+ r, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+
|
|
|
+ cone1.translate(0, -h / 2, 0);
|
|
|
+ cone1.rotateX(Math.PI * 1);
|
|
|
+
|
|
|
+ // 下方圆锥
|
|
|
+ const cone2 = new THREE.ConeGeometry(
|
|
|
+ r1, // radius — 圆锥底部的半径,默认值为1
|
|
|
+ h1, // height — 圆锥的高度,默认值为1
|
|
|
+ 32, // radialSegments — 圆锥侧面周围的分段数,默认为32
|
|
|
+ 1, // heightSegments — 圆锥侧面沿着其高度的分段数,默认值为1
|
|
|
+ false, // openEnded — 一个Boolean值,指明该圆锥的底面是开放的还是封顶的。默认值为false,即其底面默认是封顶的
|
|
|
+ 0, // thetaStart — 第一个分段的起始角度,默认为0
|
|
|
+ 2 * Math.PI, // thetaLength — 圆锥底面圆扇区的中心角,通常被称为“θ”(西塔)。默认值是2*Pi,这使其成为一个完整的圆锥
|
|
|
+ );
|
|
|
+ cone2.translate(0, -h1 / 2, 0);
|
|
|
+
|
|
|
+
|
|
|
+ const circle1 = new THREE.CircleGeometry(r, 32);
|
|
|
+ circle1.rotateX(Math.PI * 0.5);
|
|
|
+ circle1.translate(0, h, 0);
|
|
|
+
|
|
|
+ const circle2 = new THREE.CircleGeometry(r1, 32);
|
|
|
+ circle2.rotateX(Math.PI * 0.5);
|
|
|
+ circle2.translate(0, -h1, 0);
|
|
|
+
|
|
|
+
|
|
|
+ if (near > 0) {
|
|
|
+ const sphere1 = new THREE.SphereGeometry(
|
|
|
+ near, // radius — 球体半径,默认为1
|
|
|
+ 32, // widthSegments — 水平分段数(沿着经线分段),最小值为3,默认值为32
|
|
|
+ 16, // heightSegments — 垂直分段数(沿着纬线分段),最小值为2,默认值为16
|
|
|
+ 0, // phiStart — 指定水平(经线)起始角度,默认值为0
|
|
|
+ Math.PI * 2, // phiLength — 指定水平(经线)扫描角度的大小,默认值为 Math.PI * 2
|
|
|
+ 0, // thetaStart — 指定垂直(纬线)起始角度,默认值为0
|
|
|
+ Math.PI // thetaLength — 指定垂直(纬线)扫描角度大小,默认值为 Math.PI
|
|
|
+ );
|
|
|
+ this.z1 = new ThreeBSP(sphere1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.x1 = new ThreeBSP(circle1); // up
|
|
|
+ this.y1 = new ThreeBSP(cone1);
|
|
|
+ this.x2 = new ThreeBSP(circle2); // down
|
|
|
+ this.y2 = new ThreeBSP(cone2);
|
|
|
},
|
|
|
initBSP(onlyClear = false) {
|
|
|
const obj = this.scene.getObjectByName("cube");
|
|
@@ -1972,7 +2459,6 @@ export default {
|
|
|
}
|
|
|
}, 0)
|
|
|
|
|
|
-
|
|
|
setTimeout(() => {
|
|
|
// 解决bsp内存溢出后没法去掉loading
|
|
|
let timer = setTimeout(() => {
|
|
@@ -2026,7 +2512,8 @@ export default {
|
|
|
// console.log(this.coordinateA);
|
|
|
|
|
|
if (this.type != 2) {
|
|
|
- if (this.coordinate.f <= 0 || this.coordinate.n < 0 || this.coordinate.f <= this.coordinate.n) {
|
|
|
+ if (this.coordinate.f <= 0 || this.coordinate.n < 0 || this.coordinate.f <= this.coordinate.n
|
|
|
+ || this.coordinate.h <= 0 || this.coordinate.v <= 0) {
|
|
|
tryHideFullScreenLoading();
|
|
|
return;
|
|
|
}
|
|
@@ -2040,7 +2527,8 @@ export default {
|
|
|
|
|
|
|
|
|
} else {
|
|
|
- if (this.coordinateA.f <= 0 || this.coordinateA.n < 0 || this.coordinateA.f <= this.coordinateA.n) {
|
|
|
+ if (this.coordinateA.f <= 0 || this.coordinateA.n < 0 || this.coordinateA.f <= this.coordinateA.n
|
|
|
+ || (this.coordinateA.hl + this.coordinateA.hr <= 0) || (this.coordinateA.vt + this.coordinateA.vb <= 0)) {
|
|
|
tryHideFullScreenLoading();
|
|
|
return;
|
|
|
}
|
|
@@ -2048,10 +2536,10 @@ export default {
|
|
|
coordinate = {
|
|
|
farDistance: this.coordinateA.f / 100,
|
|
|
nearDistance: this.coordinateA.n / 100,
|
|
|
- fovHLeft: this.coordinateA.hl,
|
|
|
- fovHRight: this.coordinateA.hr,
|
|
|
- fovVTop: this.coordinateA.vt,
|
|
|
- fovVBottom: this.coordinateA.vb,
|
|
|
+ fovHLeft: this.coordinateA.hl == 0 ? 1 : this.coordinateA.hl,
|
|
|
+ fovHRight: this.coordinateA.hr == 0 ? 1 : this.coordinateA.hr,
|
|
|
+ fovVTop: this.coordinateA.vt == 0 ? 1 : this.coordinateA.vt,
|
|
|
+ fovVBottom: this.coordinateA.vb == 0 ? 1 : this.coordinateA.vb,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2095,7 +2583,7 @@ export default {
|
|
|
|
|
|
this.$emit('loadingDone', 'carDone');
|
|
|
},
|
|
|
- toCube(coordinate, m) {
|
|
|
+ toCube0(coordinate, m) {
|
|
|
let { fovH, fovV, nearDistance } = coordinate;
|
|
|
|
|
|
this.initContent0(coordinate, 'h', 'f');
|
|
@@ -2199,7 +2687,70 @@ export default {
|
|
|
this.z2 = null;
|
|
|
this.w2 = null;
|
|
|
},
|
|
|
- toCubeOgt(coordinate, m) {
|
|
|
+ toCube(coordinate, m) {
|
|
|
+ let { fovH, fovV, nearDistance } = coordinate;
|
|
|
+
|
|
|
+ this.initContent0(coordinate, 'h', 'f');
|
|
|
+ // this.initContent0(coordinate, 'v', 'f');
|
|
|
+
|
|
|
+ this.initContent01(coordinate);
|
|
|
+
|
|
|
+
|
|
|
+ // 水平小于等于180
|
|
|
+ if (fovH <= 180) {
|
|
|
+ // 带盲区
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1.subtract(this.b1).subtract(this.c1)
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1.subtract(this.b1).subtract(this.c1)
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ } else if (fovH > 180 && fovH < 360) {
|
|
|
+ // 180-360之间
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1.subtract(this.b1.intersect(this.c1))
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1.subtract(this.b1.intersect(this.c1))
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 大于等于360
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.a1 = null;
|
|
|
+ this.b1 = null;
|
|
|
+ this.c1 = null;
|
|
|
+ this.d1 = null;
|
|
|
+ this.a2 = null;
|
|
|
+ this.b2 = null;
|
|
|
+ this.c2 = null;
|
|
|
+ this.d2 = null;
|
|
|
+ this.x1 = null;
|
|
|
+ this.y1 = null;
|
|
|
+ this.z1 = null;
|
|
|
+ this.w1 = null;
|
|
|
+ this.x2 = null;
|
|
|
+ this.y2 = null;
|
|
|
+ this.z2 = null;
|
|
|
+ this.w2 = null;
|
|
|
+ },
|
|
|
+ toCubeOgt0(coordinate, m) {
|
|
|
let { fovHLeft, fovHRight, fovVTop, fovVBottom, nearDistance } = coordinate;
|
|
|
|
|
|
this.initContentOgt(coordinate, 'h', 'f');
|
|
@@ -2311,6 +2862,73 @@ export default {
|
|
|
this.z2 = null;
|
|
|
this.w2 = null;
|
|
|
},
|
|
|
+ toCubeOgt(coordinate, m) {
|
|
|
+ let { fovHLeft, fovHRight, fovVTop, fovVBottom, nearDistance } = coordinate;
|
|
|
+
|
|
|
+ if (fovHLeft + fovHRight > 360) {
|
|
|
+ coordinate.fovHLeft = 180
|
|
|
+ coordinate.fovHRight = 180
|
|
|
+ }
|
|
|
+
|
|
|
+ this.initContentOgt(coordinate, 'h', 'f');
|
|
|
+ // this.initContentOgt(coordinate, 'v', 'f');
|
|
|
+
|
|
|
+ this.initContentOgt1(coordinate);
|
|
|
+
|
|
|
+
|
|
|
+ // 水平小于等于180
|
|
|
+ if (fovHLeft + fovHRight <= 180) {
|
|
|
+ // 带盲区
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1)
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1.intersect(this.d1).subtract(this.b1).subtract(this.c1)
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ // 180-360之间
|
|
|
+ } else if ((fovHLeft + fovHRight > 180) && (fovHLeft + fovHRight < 360)) {
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1.intersect(this.d1).subtract(this.b1.intersect(this.c1))
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1.intersect(this.d1).subtract(this.b1.intersect(this.c1))
|
|
|
+ .subtract(this.x1).subtract(this.y1).subtract(this.y2).intersect(this.x2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 大于等于360
|
|
|
+ if (nearDistance > 0) {
|
|
|
+ this.cube = this.a1
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2).subtract(this.z1)
|
|
|
+ .toMesh(m);
|
|
|
+ } else {
|
|
|
+ this.cube = this.a1
|
|
|
+ .subtract(this.x1).subtract(this.y1).intersect(this.x2).subtract(this.y2)
|
|
|
+ .toMesh(m);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.a1 = null;
|
|
|
+ this.b1 = null;
|
|
|
+ this.c1 = null;
|
|
|
+ this.d1 = null;
|
|
|
+ this.a2 = null;
|
|
|
+ this.b2 = null;
|
|
|
+ this.c2 = null;
|
|
|
+ this.d2 = null;
|
|
|
+ this.x1 = null;
|
|
|
+ this.y1 = null;
|
|
|
+ this.z1 = null;
|
|
|
+ this.w1 = null;
|
|
|
+ this.x2 = null;
|
|
|
+ this.y2 = null;
|
|
|
+ this.z2 = null;
|
|
|
+ this.w2 = null;
|
|
|
+ },
|
|
|
// 初始化传感器
|
|
|
initSensor(
|
|
|
pos = { x: 0, y: 0, z: 0 },
|