You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/sample/select.md

1.3 KiB

1.使用八叉树过滤大部分搜索.

2.拦选. ->使用Box求交(提前过滤.) ->点在盒子内部() ->使用线相交(只要保证线相交就OK) End

3.框选 ->使用box包含(提前过滤) End

使用GPU优化

https://github.com/electricessence/ThreeBSP https://github.com/chandlerprall/ThreeCSG

#平截头体 https://stackoverflow.com/questions/27295415/three-js-select-tool-how-to-detect-the-intersection-of-a-2d-square-and-3d-obj/37136190#37136190

#ver2:

构建截椎体.

选择 ->过滤掉点选到的对象. ->使用box相交(提前过滤)

框选 ->使用每个点在截锥体内部

栏选 ->遍历所有的线, 如果有条线在截锥体内部 或者 相交 那么返回TRUE

pickStart(选择开始) //LeftClick if(pickEntity) { retrun pickEntity; }

let flustum = createFlustun();//创建平截头体.

//提前过滤出相交的图元 let InterestEntity = showEntityList.filter(e=>{ return e.intersec(flustum) })

if(框选) { for(let entity of InterestEntity) { //所有的点在平截头体内部 那么返回treu isContainer=true; for(let pt of entity) { if(!flustum.contaisPoint(pt)) { inContainer=false; break; } } } } else//栏选 {

}