Brad Christiansen wrote:
> Hi,
>
> What is the best way to get the distance between two points?
>
> ie I want the straight line distance between (0.3, 3, -5) and (6, -3.54,
> 75)

double d =Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-2));

You can also do (where p1 and p2 are Point3d)

p1.set(x1,y1,z1);
p2.set(x2,y2,z2);
double d = p1.distance(p2);

BTW, I'm afraid you will have to check some 3d geometry books anyway if
you want to play with 3d graphics. When you will start to work with
matrices/quaterions it will be not so easy.

Artur

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to