Drawing polygons by hand with snap and parallel lines (any known FOSS implementation?)

Hi there,

I wrote a simple code to draw polygons with the mouse. Basically you can start clicking to create vertices and click near the first vertex to close the polygon. I can do that multiple times to create multiple polygons in the scene.

Now I would like to make some improvements like:

  • Angle assistance (the tool helps you draw in directions that form a multiple of 15 degrees with the previous segment)
  • Snap (to existing vertices or existing sides of polygons)

I think I have an idea on how to do it but, before starting something from zero, I thought maybe there was a known FOSS project or code example that already implemented this using Three.js.

I did not find it when searching myself, but maybe someone knows of any project/example like that? :blush:

It seems like the typical CAD design use case:

Thanks in advanced for your help!

2 Likes

I’ve stumbled across the same problem, I did find an example Blueprint 3D - Example
and source code is at: https://github.com/furnishup/blueprint3d/tree/master/src

But I still haven’t been able to get to the actual implementation of it.
@Mugen87 Can you please suggest anything?