共计 558 个字符,预计需要花费 2 分钟才能阅读完成。
// 获取对象的包围盒
getObjboundsById(objId){var box = new THREE.Box3();
var bounds = new THREE.Box3();
var instanceTree = viewer.model.getData().instanceTree;
var fragList = viewer.model.getFragmentList();
box.makeEmpty();
bounds.makeEmpty();
instanceTree.enumNodeFragments(objId, function (fragId) {fragList.getWorldBounds(fragId, box);
bounds.union(box)
}, true)
return bounds
}
// 获取中心位置
getObjPosition(dbId){var bound = vmethods.getObjboundsById(dbId);
var posx = (bound.max.x + bound.min.x) / 2;
var posy = (bound.max.y + bound.min.y) / 2;
var posz = (bound.max.z + bound.min.z) / 2;
var pos = {
x:posx,
y:posy,
z:posz
}
return pos;
}
正文完
发表至: javascript
2019-04-29