Sislar
2018-07-20 13:09:24 UTC
New here but not new to programming. Been enjoy openscad for a while now and
made a few things But I'm stumped so far trying to make a voronoi pattern.
Been looking into it for a few weeks and I think i have found a the
algorithms but they are fairly complex. Would it be possible to write this
in openscad script or would it need to be a new feature/primitive in
Openscad?
What i was thinking was the function or primitive would be for 2d at least
to start applying it to
an arbitrary surface... well I'm not that advanced yet.
voronoi( B= bounding polygon, P = set of points, r = Rounding, t =
thickness)
First step is to convert the set of points to a set of non overlapping
triangles via
https://en.wikipedia.org/wiki/Delaunay_triangulation
Now the math there is pretty daunting but fortunately someone wrote a paper
on someone simple implementation. the following link has about 20 lines of
pseudo code.
https://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm
For Each Point in P find all the triangles from step one that have this
point as one of the vertices.
Then you find the circumcenter of each triangle. (This is fairly easy and I
have openscad script for this) for this point and the poloygon of these
points is the voronoi area.
from there is easy, you can just offset (-r) and minoski with the rounding
parameter.
The way variable are handle I'm not sure if I can do all the math (I have a
ton of C experience), I don't think I've fully adjusted to how openscad
doesn't have true variables yet.
--
Sent from: http://forum.openscad.org/
made a few things But I'm stumped so far trying to make a voronoi pattern.
Been looking into it for a few weeks and I think i have found a the
algorithms but they are fairly complex. Would it be possible to write this
in openscad script or would it need to be a new feature/primitive in
Openscad?
What i was thinking was the function or primitive would be for 2d at least
to start applying it to
an arbitrary surface... well I'm not that advanced yet.
voronoi( B= bounding polygon, P = set of points, r = Rounding, t =
thickness)
First step is to convert the set of points to a set of non overlapping
triangles via
https://en.wikipedia.org/wiki/Delaunay_triangulation
Now the math there is pretty daunting but fortunately someone wrote a paper
on someone simple implementation. the following link has about 20 lines of
pseudo code.
https://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm
For Each Point in P find all the triangles from step one that have this
point as one of the vertices.
Then you find the circumcenter of each triangle. (This is fairly easy and I
have openscad script for this) for this point and the poloygon of these
points is the voronoi area.
from there is easy, you can just offset (-r) and minoski with the rounding
parameter.
The way variable are handle I'm not sure if I can do all the math (I have a
ton of C experience), I don't think I've fully adjusted to how openscad
doesn't have true variables yet.
--
Sent from: http://forum.openscad.org/