POV-Ray : Newsgroups : povray.general : questions on parametric objects and 3d splines : Re: questions on parametric objects and 3d splines Server Time
3 Aug 2024 16:23:28 EDT (-0400)
  Re: questions on parametric objects and 3d splines  
From: lars petter
Date: 24 Mar 2004 09:57:54
Message: <4061a1f2$1@news.povray.org>
Ok Mr Mike, now i've tried out your code example, and gotten a circle up and
running.. the problem now is the caustics, they do come up, but not as good
as i want them =)

The circle is constructed with csg, i pull a thin box along a parametrisised
curve, and union all the different translated boxes i get.

I've put the code and render up on a page, it's "the almost version" =)
http://hovedprosjekter.hig.no/v2004/data/gruppe11/code_and_pic.html

I get fewer photon maps on this one, i guess that is what makes the caustics
poorer.. tips anyone? =)
("the right version" is what i'm looking for quality-wise, or at least
closer)

best regards,
lars petter
----------------------------------------------------------------------------
-----------------------------------------------------------------

"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:mlb### [at] econymdemoncouk...
> All objects in POV are "hollow" in the sense meant in that part of the
> documentation. The only difference with parametric objects is that many
> sets of parametric equations result in surfaces that are open.
>
> I guess that you're only thinking of using the "parametric object"
> because you're working with "parameterisised functions" and they sound a
> bit like they might be the same sort of thing. The tricky bit is going
> to be that the "parameterisised functions" that create your curves are
> likely to be three one-dimensional functions, whereas the POV parametric
> object requires three two-dimensional functions.
>
> Do take a look at the "bent prism" and the "sweepspline" in my
> isosurface tutorial.
> <http://www.econym.demon.co.uk/isotut/more.htm>
> <http://www.econym.demon.co.uk/isotut/splines.htm>
>
> but you might be better off just doing exactly what is drawn in that gif
> image you mentioned. Draw a large number of rounded rectangles that
> follow the curve. If you draw them so that they are closer than a pixel
> then they look like a continuous shape.
>
> Here's some code that does that. Note the "Turn" parameter which
> determines whether the rectangles are placed perpendicular to the path
> or perpendicular to the z-axis.
>
> #version 3.5;
> global_settings {assumed_gamma 1.0}
> camera {location  <0,0,-10> look_at <0,0,0> angle 30}
> background {rgb 1}
> light_source {<30, 100, -30> color rgb 1}
> #include "transforms.inc"
>
> // The "spline" parameters
> #declare fx=function(u){sin(u)+cos(2*u)}
> #declare fy=function(u){sin(3*u)}
> #declare fz=function(u){u}
>
> #declare Height=0.5;            // Rectangle Height
> #declare Width=0.3;             // Rectangle Width
> #declare Radius=0.05;           // Rectangle roundness
> #declare Step = Radius/50;      // Make this smaller for larger images
>                                 // and smaller for quick tests
>
> #declare Turn=1;             // set to 0 for the Rectangle to not turn
>
> #declare Rect = union {
>   sphere {<Width,Height,0>,Radius}
>   sphere {<-Width,Height,0>,Radius}
>   sphere {<-Width,-Height,0>,Radius}
>   sphere {<Width,-Height,0>,Radius}
>   cylinder {<Width,Height,0><-Width,Height,0>,Radius}
>   cylinder {<-Width,Height,0><-Width,-Height,0>,Radius}
>   cylinder {<-Width,-Height,0><Width,-Height,0>,Radius}
>   cylinder {<Width,-Height,0><Width,Height,0>,Radius}
>   pigment {rgb 1}
> }
>
> #declare E=0.00001;
> #declare i=-1;
> #while (i<1)
>   //Use this to show the track of the "spline"
>   //sphere {<fx(i),fy(i),fz(i)>,0.01 pigment {rgb x}}
>
>   #if (Turn)
>     // calculate the direction
>     #declare D=<fx(i),fy(i),fz(i)> - <fx(i-E),fy(i-E),fz(i-E)>;
>     // sweep out with turning rounded rectangle
>     object {Rect
>       transform {Reorient_Trans(z,D)}
>       translate <fx(i),fy(i),fz(i)>
>     }
>   #else
>     // sweep out with rounded rectangle
>     object {Rect translate <fx(i),fy(i),fz(i)>}
>   #end
>   #declare i=i+Step;
> #end
>
> -- 
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.