/* Example usage of rounded_lsweep.inc The rounded_lsweep macro creates an object much like a linear sphere_sweep, only the corners at each point are rounded off. It is constructed from cylinders and tori (and sometimes discs), so the result renders quickly. The object can be used with transparency and media without any problems, but only if the arc radii (more on that below) you provide can give the corners some "elbow room". The object can be used in CSG operations. You declare an array of 4d vectors. The first three values of each vector place the point in space. These describe a linear spline. The fourth value is the arc radius for that point. It determines how wide the curve for a corner will be. If the 4th value is zero, then the default arc radius you provided for the rounded_lsweep macro is given instead. The macro is thus: rounded_lsweep( pts, arc_rad, l_thick ) * pts = An array of 4d vectors. * arc_rad = The default arc radius. * l_thick = The line thickness. If the first and last points are the same, the "spline" will close itself automatically. If the spline is open, a disc will be placed at the first and last points to make the object solid. Caveats: * The default arc radius must be more than 0, unless you want to experience ugly rendering errors. It can be 0.00001 or whatever, just as long as it's more than your system's epsilon value. * For a closed spline, make sure the 4d vectors for the first and last points are the same. This includes the arc radii. * The macro will not adjust the arc radii if they are too large to fit the object at a given point. If they are too big, you will get incorrect results. It's best to start with a reasonable default arc radius and then add a custom radius for each point after that. * The macro will sometimes throw warnings. These aren't fatal. I might fix them at a later time. There is also a visualization macro to aid you during the modeling stage: rounded_lsweep_actual( pts, sph_rad ) * pts = An array of 4d vectors. * sph_rad = The radius of the control points. The lines between them will be given a thickness of sph_rad/2. */ //*************** // begin example #include"rounded_lsweep.inc" #declare pts = array[4]{ < 0, .8, 0, .5>, <-1, -.8, 0, 0>, < 1, -.8, 0, 0>, < 0, .8, 0, .5> } object{ rounded_lsweep( pts, .1, .05 ) pigment{ rgb<.1,.4,1> } } rounded_lsweep_actual( pts, .025 ) // end example //************* //************* // begin scene camera{ //orthographic right x*2 up y*2 location <3,10,-10> look_at 0 angle 10 } light_source{ <.27,1,-.3>*100000, 1} union{ plane{y,-1 } plane{z,1 } pigment{checker rgb .85, rgb 1 translate .5 scale .2} } // end scene //***********