@@ -84318,6 +84318,7 @@ class SimpleWall extends Element {
8431884318 this.startPoint = new THREE.Vector3(0, 0, 0);
8431984319 this.endPoint = new THREE.Vector3(1, 0, 0);
8432084320 this._openings = new Map();
84321+ this._corners = new Map();
8432184322 this.type = type;
8432284323 const profile = new RectangleProfile(model);
8432384324 this.body = new Extrusion(model, profile);
@@ -84348,34 +84349,33 @@ class SimpleWall extends Element {
8434884349 this.model.set(reps);
8434984350 this.updateGeometryID();
8435084351 super.update(updateGeometry);
84352+ // this.updateAllCorners();
8435184353 }
84352- extend(wall, isEnd = true) {
84354+ extend(wall, atTheEndPoint = true) {
8435384355 const zDirection = new THREE.Vector3(0, 0, 1);
8435484356 const normalVector = wall.direction.cross(zDirection);
84355- const correctNormalVector = new THREE.Vector3(normalVector.x, normalVector.z, normalVector.y * -1);
84357+ const correctedNormalVector = new THREE.Vector3(normalVector.x, normalVector.z, normalVector.y * -1);
8435684358 const coplanarPoint = new THREE.Vector3(wall.startPoint.x, wall.startPoint.z, wall.startPoint.y * -1);
84357- const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(correctNormalVector , coplanarPoint);
84358- const correctDirection = new THREE.Vector3(this.direction.x * -1, this.direction.z, this.direction.y);
84359- if (isEnd ) {
84360- correctDirection .negate();
84359+ const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(correctedNormalVector , coplanarPoint);
84360+ const correctedDirection = new THREE.Vector3(this.direction.x * -1, this.direction.z, this.direction.y);
84361+ if (atTheEndPoint ) {
84362+ correctedDirection .negate();
8436184363 }
84362- const origin = isEnd ? this.endPoint : this.startPoint;
84363- const sign = isEnd ? -1 : 1;
84364+ const origin = atTheEndPoint ? this.endPoint : this.startPoint;
84365+ const sign = atTheEndPoint ? -1 : 1;
8436484366 const rayOriginPoint = new THREE.Vector3(origin.x, origin.z, origin.y * sign);
84365- const rayAxisWall1 = new THREE.Ray(rayOriginPoint, correctDirection );
84367+ const rayAxisWall1 = new THREE.Ray(rayOriginPoint, correctedDirection );
8436684368 const intersectionPoint = rayAxisWall1.intersectPlane(plane, new THREE.Vector3());
8436784369 if (intersectionPoint) {
84368- const correctIntersectionPoint = new THREE.Vector3(intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.x, (intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.z) * -1, intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.y);
84369- if (isEnd ) {
84370- this.endPoint = correctIntersectionPoint ;
84370+ const correctedIntersectionPoint = new THREE.Vector3(intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.x, (intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.z) * -1, intersectionPoint === null || intersectionPoint === void 0 ? void 0 : intersectionPoint.y);
84371+ if (atTheEndPoint ) {
84372+ this.endPoint = correctedIntersectionPoint ;
8437184373 }
8437284374 else {
84373- this.startPoint = correctIntersectionPoint ;
84375+ this.startPoint = correctedIntersectionPoint ;
8437484376 }
84375- this.update(true);
8437684377 wall.update(true);
84377- console.log("correctIntersectionPoint", correctIntersectionPoint);
84378- return correctIntersectionPoint;
84378+ return correctedIntersectionPoint;
8437984379 }
8438084380 return null;
8438184381 }
@@ -84384,30 +84384,33 @@ class SimpleWall extends Element {
8438484384 if (!intersectionPoint)
8438584385 return;
8438684386 const angle = wall.rotation.z - this.rotation.z;
84387- const angle2 = Math.asin( this.direction.dot(wall.direction) /
84388- (this.direction.length() * wall.direction.length())) ;
84387+ const theta = this.direction.dot(wall.direction) /
84388+ (this.direction.length() * wall.direction.length());
8438984389 let sign = 1;
84390- if ((angle2 < 0 && atTheEndPoint) || (angle2 > 0 && !atTheEndPoint)) {
84390+ if ((Math.asin(theta) < 0 && atTheEndPoint) ||
84391+ (Math.asin(theta) > 0 && !atTheEndPoint)) {
8439184392 sign = -1;
8439284393 }
8439384394 const width1 = this.type.width;
84394- const width2 = this .type.width;
84395+ const width2 = wall .type.width;
8439584396 const distance1 = this.midPoint.distanceTo(intersectionPoint);
8439684397 const distance2 = wall.midPoint.distanceTo(intersectionPoint);
84397- const halfSpace1 = new HalfSpace(this.model);
84398- halfSpace1.position.x = distance1 - width1 / (2 * Math.sin(angle));
84399- halfSpace1.rotation.y = angle;
84400- halfSpace1.rotation.x = Math.PI / 2;
84401- halfSpace1.update();
84402- const halfSpace2 = new HalfSpace(this.model);
84403- halfSpace2.position.x = sign * distance2 + width2 / (2 * Math.sin(angle));
84404- halfSpace2.rotation.y = angle;
84405- halfSpace2.rotation.x = -Math.PI / 2;
84406- halfSpace2.update();
84407- this.body.addSubtraction(halfSpace1);
84408- wall.body.addSubtraction(halfSpace2);
84398+ const hsInteriorWall2 = new HalfSpace(this.model);
84399+ hsInteriorWall2.position.x = distance1 - width2 / (2 * Math.sin(angle));
84400+ hsInteriorWall2.rotation.y = angle;
84401+ hsInteriorWall2.rotation.x = Math.PI / 2;
84402+ hsInteriorWall2.update();
84403+ const hsExteriorWall1 = new HalfSpace(this.model);
84404+ hsExteriorWall1.position.x =
84405+ sign * distance2 + width1 / (2 * Math.sin(angle));
84406+ hsExteriorWall1.rotation.y = angle;
84407+ hsExteriorWall1.rotation.x = -Math.PI / 2;
84408+ hsExteriorWall1.update();
84409+ this.body.addSubtraction(hsInteriorWall2);
84410+ wall.body.addSubtraction(hsExteriorWall1);
8440984411 wall.update(true);
84410- this.update(true);
84412+ const id = wall.attributes.expressID;
84413+ this._corners.set(id, { wall, atTheEndPoint });
8441184414 }
8441284415 addOpening(opening) {
8441384416 super.addOpening(opening);
0 commit comments