mirror of https://gitee.com/cf-fz/WebCAD.git
parent
302ce77891
commit
4acce41929
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,16 @@
|
||||
import { RenderType } from '../src/GraphicsSystem/Enum';
|
||||
import { Solid3d } from '../src/DatabaseServices/Entity';
|
||||
import * as THREE from 'three';
|
||||
import { GeUtils } from "../src/Geometry/GeUtils";
|
||||
let box = new Solid3d(10, 10, 10);
|
||||
let obj = box.Draw(RenderType.Wireframe);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
let move = new THREE.Matrix4();
|
||||
move.makeTranslation(100, 0, 0);
|
||||
box.applyMatrix4(move);
|
||||
|
||||
|
||||
let b = GeUtils.GetBox(obj, true);
|
||||
|
||||
console.log('b: ', b);
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { app } from '../ApplicationServices/Application';
|
||||
import * as THREE from 'three';
|
||||
export function log(msg)
|
||||
{
|
||||
app.m_Editor.m_CommandStore.Prompt(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue