优化:避免精度误差导致的ParseHinge异常

pull/2216/head
ChenX 1 year ago
parent 6ce0d1daef
commit df7d4757e6

@ -3,6 +3,7 @@ import { app } from "../../ApplicationServices/Application";
import { arrayPushArray } from "../../Common/ArrayExt";
import { Log } from "../../Common/Log";
import { Intent } from "../../Common/Toaster";
import { FuzzyFactory } from "../../csg/core/FuzzyFactory";
import { CADObject } from "../../DatabaseServices/CADObject";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Entity } from "../../DatabaseServices/Entity/Entity";
@ -144,6 +145,8 @@ function ParseHingeToDoor(door: Entity, hingObjId: ObjectId<CADObject>[], hingeM
{
let doorBox = door.Clone().ApplyMatrix(door.SpaceOCSInv).BoundingBox;
let fuzz = new FuzzyFactory(1, 0.1);
for (let hid of hingObjId)
{
let hw = hid?.Object as HardwareCompositeEntity;
@ -160,7 +163,7 @@ function ParseHingeToDoor(door: Entity, hingObjId: ObjectId<CADObject>[], hingeM
posArr = [];
hingeMap.set(key, posArr);
}
posArr.push(new Vector2(Math.round(pos.x), Math.round(pos.z)));
posArr.push(new Vector2(fuzz.lookupOrCreate([pos.x], Math.round(pos.x)), Math.round(pos.z)));
}
}
}

Loading…
Cancel
Save