1. //-- 剖切方法如下,createMyOwnPlane方法中必须要用viewer.impl
var planes = [];
var p1 = new THREE.Vector4(0, 0, -1, -35);
var p2 = new THREE.Vector4(0, 0, 1, -(-21.6));
planes.push(p1);
planes.push(p2);
window.createMyOwnPlane(window.yst_viewer.impl,planes)
- //-- 将此方法放到section.js中,用来调用上面的 updateCapMeshes() 函数
window.createMyOwnPlane = function ( _viewer, _sectionPlanes ) {
if (_sectionPlanes.length === 2) {
console.log(_sectionPlanes)
updateCapMeshes(_viewer, new THREE.Plane().setComponents(_sectionPlanes[1].x, _sectionPlanes[1].y, _sectionPlanes[1].z, _sectionPlanes[1].w));
}
_viewer.setCutPlanes(_sectionPlanes);
}
3.调用section.js中的updateCapMeshes,即可添加遮盖面。