1

I've been working for years on Processing, and I'm now in the process of "migrating" on js/node. Something I've quite worked on in the past is g-code generation. Now, I'm now a bit familiar with the svg implementation on vanilla js and as well on the main library, and something quite crucial for me was getting point on lines (apparently possible just on path, but i can convert everything into paths). Something i was still unable to do, anyway, It is something that was quite easy in Processing, with Geomerative.

I mean converting a shape into a polygon in a more efficient way: as far I've understood it is only possible getting points at a certain length with the js tools I've tried, so you divide the total length for the amount of steps you want and you get an array.

But on a straight line you just need the two ends, and the point distribution need to be higher on curves with a smaller radius. I'm wondering if someone know a way to get points this way, like in Geomerative you can with the Polygonizer adaptative option.

Thanks!

Fuzzyma
  • 7,619
  • 6
  • 28
  • 60
piLeoni
  • 131
  • 13
  • Just loop trough the points and look if there are on a line. Then remove the points you dont need. Beside that I dont know a tool for js which can do that – Fuzzyma Feb 15 '18 at 11:11
  • Can you link the docs of the Geomerative library you are using? – Bergi Feb 15 '18 at 12:20
  • In what data format is the "*shape*" that you are converting to a polygon stored before? And what does this question have to do with g-code? – Bergi Feb 15 '18 at 12:21
  • Here it is : http://www.ricardmarxer.com/geomerative/documentation/geomerative/RG.html#setPolygonizer(int) – piLeoni Feb 15 '18 at 13:37
  • Have to do with gcode because the simpler way to convert a shape is to use point-to point lines. In alternetive, you can use segment of circles but not things like splines. – piLeoni Feb 15 '18 at 13:39

0 Answers0