I have a loop for many objects for example spheres joined into a grid and i
want to make an intersection of all of them to have a kind of chainmail of
them,
How can i do it?
--
View this message in context: http://forum.openscad.org/how-to-use-intersection-inside-a-loop-tp14070.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I have a loop for many objects for example spheres joined into a grid and i
want to make an intersection of all of them to have a kind of chainmail of
them,
You probably need intersection_for() which prevents the implicit union at for()
that causes "intersection() for()" producing unexpected results.
ciao,
Torsten.
ah ok, so with the example with some cubes in a grid i think i have to
compare every cube to every neighbour cube using if statement and distance
and bounding box and intersection any two neighbour cubes and then union the
results... I could even compare every cube with every other cube and union
each comparison. either way, it seems to be a difficult task.
The intersection_for() gives the intersection of all objects in the loop,
whereas i want to keep all the surfaces in the loop where any two of the
objects intersect. it's quite inefficient to compare each object to all the
others, makes roughly 100*100 intersections if there are 100 objects :\
--
View this message in context: http://forum.openscad.org/how-to-use-intersection-inside-a-loop-tp14070p14076.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Why don't you write the simplest code that works, using intersection_for,
and then see if there is a performance problem that requires
optimization. If the code works, then you were worrying about nothing. If
the code is too slow, then you can show the forum some actual code that we
can play with and propose changes to.
On 5 October 2015 at 14:42, ufomorace ant.stewart@yahoo.com wrote:
ah ok, so with the example with some cubes in a grid i think i have to
compare every cube to every neighbour cube using if statement and distance
and bounding box and intersection any two neighbour cubes and then union
the
results... I could even compare every cube with every other cube and union
each comparison. either way, it seems to be a difficult task.
The intersection_for() gives the intersection of all objects in the loop,
whereas i want to keep all the surfaces in the loop where any two of the
objects intersect. it's quite inefficient to compare each object to all the
others, makes roughly 100*100 intersections if there are 100 objects :\
--
View this message in context:
http://forum.openscad.org/how-to-use-intersection-inside-a-loop-tp14070p14076.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
It works, it goes kindof slowly, intersection of only neighbours in 16 cubes
takes 18 seconds versus 2 seconds for only union.
--
View this message in context: http://forum.openscad.org/how-to-use-intersection-inside-a-loop-tp14070p14089.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Here is code to compare intersection between every object in a group, same as
intersection_for except it's comparing intersection between any two objects.
There is an optional distance factor, If you have for example 50 spheres
disntanced by 1 grouped into a large sphere of diameter 10, you would set
the comparison to exclude intersection if the distance is smaller than 2.
here:
--
View this message in context: http://forum.openscad.org/how-to-use-intersection-inside-a-loop-tp14070p14641.html
Sent from the OpenSCAD mailing list archive at Nabble.com.