Free-hand drawing a polygon area for selecting points

I am going to impelemate a function that allows the user to draw a polygon area to select the points within the area. I have used SelectionBox.js to finish square selection, but it is not working for free-hand drawing selection, could someone help me with this implementation?

What I have done so far

  1. put another canvas on top of the 3D canvas, for drawing purposes.
  2. collecting draw coordinates to generate a plane.

What could be my next steps

  1. Assign plane to frustum?

I will be appreciated it if someone could give me a hint to continue, thanks

If you want a precise selection, this implementation of a lasso selection might help you: three-mesh-bvh - Geometry Collect Triangles

It’s meant for three-mesh-bvh (a specialized version of raycasting for single meshes) but the principle shouldn’t change too much.

If you are happy with a more rough one: isn’t it enough to calculate top x, top y, bottom x, bottom y of your selection and then using the same logic as in the box selection? The frustum is squared anyway so you still need to use some sort of square to select with it.

Thank you for this answer! lasso selection should be the best one I learned now! Thanks, I hope it can apply to my point cloud selection successfullly! @jacopocolo