This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Calculate length of line. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calculate length of line." Watch "Calculate length of line." New topic
Author

Calculate length of line.

Jan L
Greenhorn

Joined: Apr 30, 2001
Posts: 3
Does someone now how i can calculate the length of a line between
the points (X1, Y1) and (X2, Y2) on an applet?
Thanks!


J.L
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241

In other words, take the square of the difference of your x's plus the square of the difference of the y's, and the length will be the positive square root of that sum. At heart, it's the Pythagorean theorem.
Good luck,
Art
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"Jan L",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculate length of line.
 
Similar Threads
Adding strings together
About array in Java
max value of an array
if Statements the best?
Reading the Portion of the file with the line numbes.