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.
I have learned and implemented the way your lasso, but the selected area is not matched to the point position in the scene…still struggling with this challenge. but the way to draw the line is great!
Hi, @gkjohnson
Please tell me, if I want to use lasso to select multiple models in the scene, instead of selecting triangle faces, how do I confirm which models are selected?
In fact, my main problem is to use the lasso or, the rectangular box, the circle to select the model, so I asked how to select the entire model before.
Then, there will be many models in my scene, and I want to use these tools to select them