|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import { Matrix4, Vector3 } from "three";
|
|
|
|
|
import { GetMirrorMat } from "../../Add-on/Mirror";
|
|
|
|
|
import { arrayLast } from "../../Common/ArrayExt";
|
|
|
|
|
import { matrixIsCoplane } from "../../Common/Matrix4Utils";
|
|
|
|
|
import { Board } from "../../DatabaseServices/Board";
|
|
|
|
@ -50,9 +51,9 @@ export class BoardGetFace
|
|
|
|
|
let size = box.getSize(new Vector3());
|
|
|
|
|
|
|
|
|
|
let reg: Region;
|
|
|
|
|
let isRect = this.IsRect(curve);
|
|
|
|
|
if (isRect)
|
|
|
|
|
reg = Region.CreateFromCurves([this.m_Board.Shape.Outline.Curve]);
|
|
|
|
|
let isRect = !this.m_Board.IsSpecialShape;
|
|
|
|
|
if (!isRect)
|
|
|
|
|
reg = Region.CreateFromCurves([curve]);
|
|
|
|
|
|
|
|
|
|
let thickness = this.m_Board.Thickness;
|
|
|
|
|
let ocs = this.m_Board.OCS;
|
|
|
|
@ -62,20 +63,19 @@ export class BoardGetFace
|
|
|
|
|
region: reg,
|
|
|
|
|
isRect,
|
|
|
|
|
localBoard: this.m_Board,
|
|
|
|
|
IsPositiveFace: true,
|
|
|
|
|
isPositiveFace: true,
|
|
|
|
|
matrix4: ocs.clone(),
|
|
|
|
|
length: size.x,
|
|
|
|
|
width: size.y
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
let mat = new Matrix4().makeBasis(new Vector3(-1), new Vector3(0, -1), new Vector3(0, 0, -1))
|
|
|
|
|
.setPosition(new Vector3(this.m_Board.Width, this.m_Board.Length, -thickness));
|
|
|
|
|
let mat = GetMirrorMat(cZAxis).setPosition(new Vector3(0, 0, -thickness));
|
|
|
|
|
this.m_Faces.push(new Face({
|
|
|
|
|
type: BoardFaceType.NoSide,
|
|
|
|
|
localBoard: this.m_Board,
|
|
|
|
|
isRect,
|
|
|
|
|
region: reg ? reg.Clone() : undefined,
|
|
|
|
|
IsPositiveFace: false,
|
|
|
|
|
isPositiveFace: false,
|
|
|
|
|
matrix4: new Matrix4().multiplyMatrices(ocs.clone(), mat),
|
|
|
|
|
length: size.x,
|
|
|
|
|
width: size.y
|
|
|
|
@ -104,7 +104,7 @@ export class BoardGetFace
|
|
|
|
|
this.m_Faces.push(new Face({
|
|
|
|
|
type: BoardFaceType.Side,
|
|
|
|
|
localBoard: this.m_Board,
|
|
|
|
|
IsPositiveFace: derv.x + derv.y + derv.z > 0,
|
|
|
|
|
isPositiveFace: derv.x + derv.y + derv.z > 0,
|
|
|
|
|
matrix4: new Matrix4().multiplyMatrices(this.m_Board.OCS.clone(), mat),
|
|
|
|
|
length: len,
|
|
|
|
|
width: this.m_Board.Thickness
|
|
|
|
@ -129,9 +129,12 @@ export class BoardGetFace
|
|
|
|
|
if (f1.type === BoardFaceType.NoSide || !bInsEqual)
|
|
|
|
|
continue;
|
|
|
|
|
//不共面
|
|
|
|
|
if (!matrixIsCoplane(f1.OCS, f2.OCS))
|
|
|
|
|
if (!matrixIsCoplane(f1.OCS, f2.OCS, 1e-4))
|
|
|
|
|
continue;
|
|
|
|
|
let nor1 = new Vector3().setFromMatrixColumn(f1.OCS, 2);
|
|
|
|
|
let nor2 = new Vector3().setFromMatrixColumn(f2.OCS, 2);
|
|
|
|
|
if (equalv3(nor1, nor2, 1e-6))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
let interFace = f1.Intersect(f2);
|
|
|
|
|
if (interFace)
|
|
|
|
|
collisionFaces.push(interFace);
|
|
|
|
|