|
|
In article <web.3f187c7a5afdf36ca6ac136d0@news.povray.org>,
"BorisW37" <Bor### [at] yahoocom> wrote:
> If i have 2 points A <x1,y1,z1> and B <x2,y2,z2>, how do i find coordinates
> of point C <x3,y3,z3> which lies on the line AB, distance D from point A?
vnormalize(B - A)*D + A
Find a vector pointing in the direction of the line (B-A), normalize it
so its length is 1, scale it by the desired distance, and add it to the
first point of the line. If you leave out the vnormalize(), D acts as
the percentage (as a fractional value in the range [0, 1]) of the
distance from A to B, rather than the absolute distance in units.
Or if you are just looking for the midpoint, (A + B)/2 will work.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|