POV-Ray : Newsgroups : povray.general : Point along a line. : Re: Point along a line. Server Time
4 Aug 2024 04:15:30 EDT (-0400)
  Re: Point along a line.  
From: JC (Exether)
Date: 23 Jul 2003 08:30:41
Message: <3F1E7FEE.1000002@spam.fr>
BorisW37 wrote:
> BorisW37 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?
>>
>>Thank you,
>>
>>Boris.
>>
> 
> 
> I got it:
> First find D=distance between A and B
> D=sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)
> then
> x3=x1+d/D(x2-x1)
> y3=y1+d/D(y2-y1)
> z3=z1+d/D(z2-z1)
> 
> but now i have another question, if I have a vector named my_vector
> # declare my_vector=<1,2,3>;
> 
> how do i find individual values of x,y and z
> so that i could find
> #declare my_vector_X=.....; (shoud be 1)
> #declare my_vector_Y=.....; (shoud be 2)
> #declare my_vector_Z=.....; (shoud be 3)
> 

When you have vector V, you access its coordinates with V.x, V.y and 
V.z, but it's usually better to use vectors in your formulas.

JC


Post a reply to this message

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