POV-Ray : Newsgroups : povray.general : Curved line : Re: Curved line Server Time
30 Jul 2024 12:21:44 EDT (-0400)
  Re: Curved line  
From: Chris B
Date: 18 Feb 2009 10:27:56
Message: <499c28fc$1@news.povray.org>
"twister" <twi### [at] o2pl> wrote in message 
news:web.499c1d784c7fcf678896485d0@news.povray.org...
>
> Is it possible to draw a line connecting a few points using spline 
> feature? In
> fact I need a smooth ribbon (the line is the center line of that ribbon) 
> but
> not in all directions - just in one plane (x-z). I have tried using prisms 
> but
> I have problems with constant width of that shape along whole length.
> Let me know how it can be made - just some clue.
> Thanks in advance.
>
> Of course if something is unclear, let me know...
>

Your description is a little unclear to me but ...

I imagine that you are describing something lying flat on the XZ-plane 
winding around like a track or a roadway or something like that?

If that is what you want, then you could define the centre line as a POV-Ray 
spline, then generate a POV-Ray prism object that follows the line of the 
spline with appropriate offsets to the left and right (to keep the width 
constant). To do this you could build the prism using two #while loops. The 
first would follow the spline from 0 to 1 and offset to the left, the second 
would follow the spline back from 1 to 0, offsetting to the right.

To offset from a spline you need to get the direction of the spline at the 
point you're interested in. You can do this using a point slightly ahead of 
or slightly behind the current position. You can then use the VPerp_To_Plane 
function from "math.inc" with the 'up' vector (y) to get a vector pointing 
out to the left (or right). Add this vector times a distance to the current 
position to get the new position that is offset from the spline.

Regards,
Chris B.


Post a reply to this message

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