|
|
Ziyan wrote:
> Now I wanna extrude a box along curve(or circle), but don't know how to
> achieve that.
> Anyone here could help me?
>
>
These examples might at least give you some
ideas or help clarify the problem.
method #1
if the curve is a circle or at least in the same plane you might
be able to use plain old csg
method #2
boxes can be strung along a spline using Reorient_Trans from
transforms.inc, but this does not create a continuous curved box
shape, just a string of boxes.
Also the uneven weighting of the spline
can be obvious
method #3
Reorient_Trans can be used to local a series of "corner points"
along the spline. These can then be used to create a mesh.
***In addition to these ideas there is the possibility of sweeping prism
shapes along a spline
http://www.econym.demon.co.uk/isotut/splines.htm
#include "transforms.inc"
#local Method = 1;
#switch ( Method )
#case ( 1 )
intersection {
difference {
torus { 10, 2 }
cylinder { y*-2, y*2, 9 }
}
cylinder { y*-2, y*2, 11 }
box { <-15, -1, -15> <15, 1, 15> }
pigment { rgb <1,1,0> }
}
#break
#case ( 2 )
#local Spline =
spline { natural_spline
0/2 <0,0,0>
1/2 <10,10,0>
2/2 <20,10,0>
};
#local Granularity = 20;
#local I=1;#while(I<Granularity)
#local Orientation =
Spline ( I/Granularity ) - Spline ( (I-1)/Granularity );
//use Reorient_Trans to reorient the box
box { <-1,0,-1>, <1,-1,1>
Reorient_Trans ( y, Orientation )
translate Spline ( I/Granularity )
pigment { rgb <1,1,0> }
}
#local I=I+1;#end
#break
#case ( 3 )
#local Spline =
spline { natural_spline
0/2 <0,0,0>
1/2 <10,10,0>
2/2 <20,10,0>
};
#local Granularity = 20;
#local I=1;#while(I<Granularity)
#local Orientation =
Spline ( I/Granularity ) - Spline ( (I-1)/Granularity );
//use Reorient_Trans to define a transform
#local Trans =
transform { Reorient_Trans ( y, Orientation )};
#local P0 =
vtransform ( <-1,0,0>, Trans) + Spline ( I/Granularity );
#local P1 =
vtransform ( <1,0,0>, Trans) + Spline ( I/Granularity );
#local P2 =
vtransform ( <1,0,1>, Trans) + Spline ( I/Granularity );
#local P3 =
vtransform ( <-1,0,1>, Trans) + Spline ( I/Granularity );
#if ( I=1 )
#local PrevP0 = P0;
#local PrevP1 = P1;
#local PrevP2 = P2;
#local PrevP3 = P3;
#else
mesh {
triangle { PrevP0, P0, P1 }
triangle { PrevP0, P1, PrevP1 }
triangle { PrevP1, P1, P2 }
triangle { PrevP1, P2, PrevP2 }
triangle { PrevP2, P2, P3 }
triangle { PrevP2, P3, PrevP3 }
triangle { PrevP3, P3, P0 }
triangle { PrevP3, P0, PrevP0 }
pigment { rgb <1,1,0> }
}
#local PrevP0 = P0;
#local PrevP1 = P1;
#local PrevP2 = P2;
#local PrevP3 = P3;
#end
#local I=I+1;#end
#break
#end
camera {
location < 30.0, 40.0, -50.0>
look_at <1.0, 1.0, 0.0>
right x*image_width/image_height
angle 35
}
light_source {
0*x
color rgb <1,1,1>
translate <-200, 200, -200>
}
Post a reply to this message
|
|