POV-Ray : Newsgroups : povray.general : Curved line : Re: Curved line Server Time
30 Jul 2024 12:23:00 EDT (-0400)
  Re: Curved line  
From: twister
Date: 18 Feb 2009 11:00:00
Message: <web.499c2f4a4c7fcf678896485d0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> 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.

Yes, you're right! I want something that is quite like a road object with
constant width and placed on X-Z plane.
I tried to use prism, but it didn't work as required (probably something was
wrong). I used a pair describing each point: point-coordinates and its vector
of "movement". The vector allowed me to get side points that are in constant
distance from center of line, but I still can't get smooth 'road'. Could you
provide me some example as I am a bit new to povray or point some reference how
to handle it?

Regards,
Twister


Post a reply to this message

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