• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calculate length of line.

 
Jan L
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does someone now how i can calculate the length of a line between
the points (X1, Y1) and (X2, Y2) on an applet?
Thanks!
 
Art Metzer
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic