> > 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) >
Given two points: P1 = (x1, y1, z1) and P2 = (x2, y2, z2) Distance is: double d = Math.sqrt(x1*x2 + y1*y2 + z1*z2) or I prefer for readability sake: import javax.vecmath.*; .... Point3d p1 = new Point3d(0.3, 3, -5); Point3d p2 = new POint3d(6, -3.54, 75); double d = p1.distance(p2); See the comp.graphics.algorithms FAQ for lots solutions to problems such as this one: http://www.faqs.org/faqs/graphics/algorithms-faq/ Tip: use squared distance where possible, as computing the square root is expensive: double dSqrd = p1.distanceSquared(p2); Simeon =========================================================================== 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".