Polygon fill elements



Can I get the vectors or plots of polygon filling algorithm out of THREE?

My idea would be to re-use the elements in a g-code generation (directly from gerber polygons I’ve parsed). A possibility to define the “painting” resolution is a requirement.

I’m totally unexperienced with three, so if this is achievable, could someone write a couple of example lines. Or any other advice.


G-code and Gerber polygons are terms from electronic circuit board design?

In any case, the idea of ‘filling’ polygons is an oversimplification. The polygons are drawn by the graphics card, using the rendering pipeline. There are two (principal) pieces of code involved, the vertex shader, which calculates the position and characteristics of each vertex and then passes the results to the fragment shader, which interpolates the results across a polygon face, although there can be other inputs to the fragment shader as well, such as lights, textures, mouse position, time etc.

So in a way the fragment shader is the filling algorithm. But it has a lot of power beyond just filling faces. Have a look at shadertoy.com - every example there is written just using a fragment shader.

On the other hand if you want to create a fragment shader that just fills a polygon, say with a single color or texture, that’s pretty easy to do.



Thank you for your prompt answer.

The background of the requirement is that I couldn’t find a tool chain from gerber output (vector format of PCB manufacturing) to G-code (final 3d-printing or CAD/CAM language).
I’m aware of the possibility to go SVG-STL, but that’s going back and forth from vectors–> tesselation-> vectors.