|
|
"christof.schuler" wrote:
>
> Hy,
> I have some hundreds of points along a special curve. Now I want to
> connect each after another with cylinders so that you have the
> impression of a tube.
> I tried cylinders (closed and open) from one to the next point but that
> didn't look good because you saw the caps. The next possibility I
> thought are prisms, but here you also can extrude only "linear" (and not
> cubic) from one point to the next.
> Is there a tool do extrude a circle or any other 2d-shape along a
> spline or along a set of points
>
> Thank you
Try this simple macro by John VanSickle. In your case where you already
have a set of point values you could store them in an array and pass them
to both the location of the spheres and the end points of the cones used
by the macro to connect the spheres locations. It's a little complicated
so I have provided a full example for you to study.
/*
By: John VanSickle
This macro creates a cone object which will smoothly connect two spheres. An
example:
object {
Connect(y*4,2,y*9,3)
texture { MyTexture }
}
This macro does not generate the spheres at each point, just the cone that
connects them.
*/
// the connect macro
#macro Connect(SP,SR,EP,ER)
#local D=vlength(EP-SP);
#local Rd=SR-ER;
#local D2=sqrt(D*D-Rd*Rd);
cone { SP+(EP-SP)/D*Rd*(SR)/D,(SR)*D2/D,EP+(EP-SP)/D*Rd*(ER)/D,(ER)*D2/D }
#end
// example of storing your points in an array
#declare Points = 9;
#declare Spline =
array [Points][3] {
{-2.0, 1, 1},
{-1.0, 2, -1},
{ 1.0, 2, 1},
{ 2.0, 1, -1},
{ 2.0, -1, 1},
{ 1.0, -2, -1},
{-1.0, -2, 1},
{-2.0, -1, -1},
{-2.0, 1, 1},
}
// place the spheres with a while loop
#declare Joints =
union{
#declare a=0;
#while (a < Points)
sphere {<Spline[a][0],Spline[a][1], Spline[a][2]>, .5 }
#declare a = a + 1;
#end }
// connect the spheres using the macro and a while loop
#declare Links =
union {
#declare ab = 0;
#while (ab < Points-1)
Connect (
<Spline[ab ][0], Spline[ab ][1], Spline[ab ][2]>, .5,
<Spline[ab+1][0], Spline[ab+1][1], Spline[ab+1][2]>, .5
)
#declare ab = ab + 1;
#end
}
#declare Your_Object =
union {
object { Joints }
object { Links }
pigment { rgb 1 }
}
object { Your_Object }
camera { location<0,0,-8> look_at 0}
light_source {<0,0,-300> rgb 1}
--
Ken Tyler - 1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
|