POV-Ray : Newsgroups : povray.general : Cylinder with origin, point_to and length : Re: Cylinder with origin, point_to and length Server Time
2 Aug 2024 20:21:46 EDT (-0400)
  Re: Cylinder with origin, point_to and length  
From: Mike Williams
Date: 31 Jul 2004 05:29:10
Message: <ugpHGAARS2CBFwI1@econym.demon.co.uk>
Wasn't it Rick Measham who wrote:
>I'm trying to work out how to create a cylinder that points at a particular
>point. I have an origin and a length (and radius of course).
>
>Given these, I'm sure it must be possible to calculate the other end of the
>cylinder (one end is the origin). The unknown end will fall upon the
>imaginary line between the origin and the point_to and will be length units
>from the origin.
>
>My 2D trig doesn't work here. I can put it on the XY axis in the correct
>position and I can put it on the YZ axis in the correct position (thus the
>XZ is also easy). However getting onto an XYZ axis is proving impossible.
>
>It's occurred to me after several hours of playing around that this problem
>must have been solved thousands of times already. If not for POV-Ray then
>for someone's math class sometime.

"vnormalize(point_to)" gives you a point that's in that direction and
unit distance from the origin. So "length*vnormalize(point_to)" gives a
point in that direction that is "length" units away.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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