mirror of https://gitee.com/cf-fz/WebCAD.git
parent
e246fb8377
commit
302ce77891
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
function getBox(obj: THREE.Object3D): THREE.Box3
|
||||
{
|
||||
if (obj.hasOwnProperty("geometry"))
|
||||
{
|
||||
let geom = obj["geometry"];
|
||||
geom.computeBoundingBox();
|
||||
return geom.boundingBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj.children.length > 0)
|
||||
{
|
||||
let box;
|
||||
for (var index = 0; index < obj.children.length; index++)
|
||||
{
|
||||
var element = obj.children[index];
|
||||
let box2 = getBox(element);
|
||||
if (box2)
|
||||
{
|
||||
if (box)
|
||||
{
|
||||
box.union(box2);
|
||||
}
|
||||
else
|
||||
box = box2;
|
||||
}
|
||||
}
|
||||
return box;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue