Depending on your use case performance may be good enough without an acceleration structure. Here’s a rough overview of the algorithm I used for finding the lasso selection for every triangle that intersects the lasso shape:
Construct a list of screen space line segments that represent the lasso shape drawn by the user.
For every triangle in the geometry check if any part is within the lasso. If it is then consider the triangle selected.
To determine whether a triangle intersects the lasso:
Project the triangle vertices and edge segments into screen space.
Check if any of the triangle vertices are within the lasso shape, which you can use the ray-crossing algorithm for. If any of the crossing numbers are different between the points or if any of the crossing counts are odd then the triangle intersects the lasso shape.
Check if any of the triangle line segments intersect any of the lasso line segments. If they do then the triangle intersects the lasso shape.
Otherwise the triangle has not been intersected.
Spatial index data structures can be used to quickly cull large sets of triangles by determining if parent bounds are entirely encapsulated by the lasso shape or do not intersect at all which can give a bit of a performance boost if needed.
thank you for help , may you kindly tell me how to apply it to sculptgl ? i have been trying but i am lost ,
and is there away to make selection by put dots or points on the 3D model and once they are connected they select the area ? and as well move the dots or points over the 3D models to adjust the selected area @gkjohnson
may you kindly tell me how to apply it to sculptgl
I cannot – I’m unfamiliar with sculptgl. It doesn’t look to be based on three.js, either.
is there away to make selection by put dots or points on the 3D model and once they are connected they select the area ? and as well move the dots or points over the 3D models to adjust the selected area
Of course it’s possible to implement this but I doubt anyone already has this feature created in a ready to use way. These are complex features and it’s probably best to make head way on your own implementation and ask more specific questions if you get stuck.