Intersection and for loop

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Intersection and for loop

Maurice van Peursem
I'm trying to do an intersection on a group of points:

Sq3=sqrt(3);
Sq2=sqrt(2);
Spheres=[[-Sq3,-1,0],[Sq3,-1,0],[0,2,0],[0,0,2*Sq2]];
Radius=2*Sq3;
$fn=72;
CW();

module CW()
{
        intersection()
        {
                for(Point=Spheres)
                {
                        translate(Point)
                  sphere(Radius);
                }
        }
}


However, the for loop results in a union, and the intersection is
evaluated afterwards. Is there a way to do an intersection on a
vector of points like this?

Maurice
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Intersection and for loop

Johannes Reinhardt
Hi,

see here:

http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Conditional_and_Iterator_Functions#Intersection_For_Loop

Greetings

Johannes
On Wed, 11 Dec 2013 14:54:23 +0100
Maurice van Peursem <[hidden email]> wrote:

> I'm trying to do an intersection on a group of points:
>
> Sq3=sqrt(3);
> Sq2=sqrt(2);
> Spheres=[[-Sq3,-1,0],[Sq3,-1,0],[0,2,0],[0,0,2*Sq2]];
> Radius=2*Sq3;
> $fn=72;
> CW();
>
> module CW()
> {
> intersection()
> {
> for(Point=Spheres)
> {
> translate(Point)
>   sphere(Radius);
> }
> }
> }
>
>
> However, the for loop results in a union, and the intersection is
> evaluated afterwards. Is there a way to do an intersection on a
> vector of points like this?
>
> Maurice
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566



--

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566