|
@@ -596,23 +596,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),
|
|
@@ -684,6 +684,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模型
|
|
@@ -723,14 +802,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),
|
|
@@ -833,6 +915,90 @@ 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);
|
|
|
},
|
|
|
initSensorBSP(position, rotation, type, index, canMove) {
|
|
|
let sensorId = this.configList[type][index].sensorId;
|
|
@@ -883,7 +1049,7 @@ export default {
|
|
|
// let m = new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, side: THREE.DoubleSide, blending: THREE.AdditiveBlending });
|
|
|
// let m = new THREE.MeshPhongMaterial({ emissive: color, color: 0x4c4c4c, wireframe: true, transparent: true, opacity: 0.3, side: THREE.DoubleSide });
|
|
|
let m = new THREE.MeshPhongMaterial({ emissive: color, color: 0x4c4c4c, transparent: true, opacity: 0.3, side: THREE.DoubleSide });
|
|
|
-
|
|
|
+
|
|
|
// showFullScreenLoading();
|
|
|
// console.log(showFullScreenLoading);
|
|
|
|
|
@@ -902,8 +1068,12 @@ export default {
|
|
|
coordinate.nearDistance = coordinate.nearDistance / 100;
|
|
|
|
|
|
if (type != "ogt") {
|
|
|
+ if (coordinate.fovH <= 0 || coordinate.fovV <= 0) return;
|
|
|
+
|
|
|
this.toCube(coordinate, m);
|
|
|
} else {
|
|
|
+ if ((coordinate.fovHLeft + coordinate.fovHRight <= 0) || (coordinate.fovVTop + coordinate.fovVBottom <= 0)) return;
|
|
|
+
|
|
|
this.toCubeOgt(coordinate, m);
|
|
|
}
|
|
|
// console.log(66);
|
|
@@ -955,7 +1125,7 @@ export default {
|
|
|
|
|
|
this.scene.add(this.cube);
|
|
|
},
|
|
|
- toCube(coordinate, m) {
|
|
|
+ toCube0(coordinate, m) {
|
|
|
let { fovH, fovV, nearDistance } = coordinate;
|
|
|
|
|
|
this.initContent0(coordinate, 'h', 'f');
|
|
@@ -1059,7 +1229,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');
|
|
@@ -1171,6 +1404,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;
|
|
|
+ },
|
|
|
// 处理轴对称物体
|
|
|
initSenA(position, rotation, coordinate, r, r1, type, canMove) {
|
|
|
let x = 0,
|