diff --git a/src/DatabaseServices/Entity/Extrude.ts b/src/DatabaseServices/Entity/Extrude.ts index ac822cf60..3731d7b3b 100644 --- a/src/DatabaseServices/Entity/Extrude.ts +++ b/src/DatabaseServices/Entity/Extrude.ts @@ -3,7 +3,7 @@ import { arrayClone, arrayLast, arrayRemoveIf, arraySortByNumber, arraySum } fro import { ColorMaterial } from "../../Common/ColorPalette"; import { equalCurve } from "../../Common/CurveUtils"; import { DisposeThreeObj } from "../../Common/Dispose"; -import { Vector2ApplyMatrix4 } from "../../Common/Matrix4Utils"; +import { Vector2ApplyMatrix4, matrixSetVector } from "../../Common/Matrix4Utils"; import { Status, UpdateDraw } from "../../Common/Status"; import { CSG } from "../../csg/core/CSG"; import { CSG2Geometry, Geometry2CSG } from "../../csg/core/Geometry2CSG"; @@ -748,9 +748,19 @@ export class ExtrudeSolid extends Entity */ ConverToLocalGroove(target: ExtrudeSolid): ExtrudeSolid[] { - if (isParallelTo(this.Normal, target.Normal)) + let n1 = this.Normal; + let n2 = target.Normal; + if (isParallelTo(n1, n2)) { target = target.Clone(); + if (!equalv3(n1, n2)) + { + let mtx = target._Matrix; + matrixSetVector(mtx, 2, n1); + let p = n1.setFromMatrixColumn(mtx, 3); + p.add(n2.multiplyScalar(target.thickness)); + matrixSetVector(mtx, 3, p); + } if (this.GrooveCheckPosition(target) !== Status.True) return [];