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.
Thanks!
Rick
From: Mike Williams
Subject: Re: Cylinder with origin, point_to and length
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