|
|
|
@ -33,7 +33,10 @@ import { IsDoor, IsHandle, IsHinge } from "../../HideSelect/HideSelectUtils";
|
|
|
|
|
* 偏移找到合适位置
|
|
|
|
|
* @type {*}
|
|
|
|
|
* */
|
|
|
|
|
const MoveNum = 8;
|
|
|
|
|
const MoveNum: number = 8;
|
|
|
|
|
|
|
|
|
|
//绘制出的铰链与层板(左右开门时)或立板(上下开门时)最低间距 或偏移后最低间距
|
|
|
|
|
export const BoxIntersectFuzz: number = 5;
|
|
|
|
|
|
|
|
|
|
export class DrawDoorTool
|
|
|
|
|
{
|
|
|
|
@ -618,7 +621,8 @@ export class DrawDoorTool
|
|
|
|
|
br2GrooveOutlinesCache.set(br, grooveOutlines);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (brBox.clone().intersect(ironBox).isSolid())
|
|
|
|
|
//门板不增加误差,防止隔壁门板误关联
|
|
|
|
|
if (brBox.clone().intersect(ironBox).isSolid() || !IsDoor(br) && brBox.intersectsBox(ironBox, BoxIntersectFuzz))
|
|
|
|
|
{
|
|
|
|
|
const center = ironBox.getCenter(new Vector3).applyMatrix4(br.OCSInv).setZ(0);
|
|
|
|
|
if (grooveOutlines.some(c => c.PtInCurve(center)))//五金的中心在造型内部
|
|
|
|
@ -675,9 +679,9 @@ export class DrawDoorTool
|
|
|
|
|
{
|
|
|
|
|
if (!IsHinge(ironware)) continue;
|
|
|
|
|
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(ironBox, [otherEnt])) continue;
|
|
|
|
|
|
|
|
|
|
if (IsDoor(otherEnt))
|
|
|
|
|
let isDoor = IsDoor(otherEnt);
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(ironBox, [otherEnt], BoxIntersectFuzz, undefined, isDoor)) continue;
|
|
|
|
|
if (isDoor)
|
|
|
|
|
{
|
|
|
|
|
//铰链归属复合门板
|
|
|
|
|
ironware.RelevanceBoards.push(otherEnt.Id);
|
|
|
|
@ -906,7 +910,7 @@ export class DrawDoorTool
|
|
|
|
|
|
|
|
|
|
if (box1Info + (isUpDownDoor ? 10 : 100) < doorSpecs)
|
|
|
|
|
{
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(realityBox1, checkEnts))
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(realityBox1, checkEnts, BoxIntersectFuzz))
|
|
|
|
|
return number;
|
|
|
|
|
else
|
|
|
|
|
return this.MoveAgain(doorSpecs, inventedBox, realityBox, checkEnts, distance, number, isUpDownDoor);
|
|
|
|
@ -936,7 +940,7 @@ export class DrawDoorTool
|
|
|
|
|
}
|
|
|
|
|
if (box2Info - (isUpDownDoor ? 10 : 100) > 0)
|
|
|
|
|
{
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(realityBox2, checkEnts))
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(realityBox2, checkEnts, BoxIntersectFuzz))
|
|
|
|
|
return -number;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1010,7 +1014,7 @@ export function SetHingeType(br: Board, ironware: HardwareCompositeEntity): void
|
|
|
|
|
* @param checkEnts 校验的实体列表
|
|
|
|
|
* @param parentOCS 父空间的坐标系
|
|
|
|
|
*/
|
|
|
|
|
export function IsBoxAndEntitysIntersect(enBox: Box3, checkEnts: Entity[], parentOCS?: Matrix4): boolean
|
|
|
|
|
export function IsBoxAndEntitysIntersect(enBox: Box3, checkEnts: Entity[], fuzz?: number, parentOCS?: Matrix4, isDoor?: boolean): boolean
|
|
|
|
|
{
|
|
|
|
|
for (let checkEnt of checkEnts)
|
|
|
|
|
{
|
|
|
|
@ -1019,22 +1023,29 @@ export function IsBoxAndEntitysIntersect(enBox: Box3, checkEnts: Entity[], paren
|
|
|
|
|
let ocs = checkEnt.OCSNoClone;
|
|
|
|
|
if (parentOCS) ocs = new Matrix4().multiplyMatrices(parentOCS, ocs);
|
|
|
|
|
|
|
|
|
|
if (IsBoxAndEntitysIntersect(enBox, checkEnt.Entitys, ocs))
|
|
|
|
|
if (IsBoxAndEntitysIntersect(enBox, checkEnt.Entitys, fuzz, ocs, isDoor))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let box = checkEnt.BoundingBox as Box3Ext;
|
|
|
|
|
if (parentOCS) box.applyMatrix4(parentOCS);
|
|
|
|
|
if (box.intersectsBox(enBox, 10))
|
|
|
|
|
return true;
|
|
|
|
|
if (isDoor)
|
|
|
|
|
{
|
|
|
|
|
if (box.clone().intersect(enBox).Volume > 0)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (box.intersectsBox(enBox, fuzz))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* 特殊铰链模板(多个实体编组)
|
|
|
|
|
* 防止 hingeSpace.GetParam("SY").value 被覆盖
|
|
|
|
|
*
|
|
|
|
|