Distance Formula

 BBS: Inland Empire Archive
Date: 06-22-92 (17:45)             Number: 1087
From: ROBERT CHURCH                Refer#: NONE
  To: CHUCK HEMPHILL                Recvd: YES 
Subj: Distance Formula               Conf: (2) Quik_Bas
 CH>  RC> I need some help with a little math.  For a game I'm writing, I
 CH> need to
 CH>  RC> not only find the distance between two points on a grid, but to
 CH> find
 CH>  RC> the POINTS on the grid.
 CH>
 CH> Robert, this might get you started. In a game utility that I wrote, I
 CH> use
 CH> the Pythagorean Theorem that basically says that in a right triangle,
 CH> the
 CH> square of hypotenuse is equal to the sum of the squares of the other
 CH> two
 CH> sides.

   Thanks, but that really wasn't my question.


    ----------------------------
   |  .  .  .  .  .  .  .  .  .     We'll say point 'a' is (1,3) and 'b'
   |  a  .  .  .  .  .  .  .  .     is (8,1).  I want to know the
   |  .  .  .  .  .  .  .  .  .     coordinates of all the points between
   |  .  .  .  .  .  .  .  b  .     two points.  It's been suggested that I
   |  .  .  .  .  .  .  .  .  .     find the slope of line 'ab' and add that
   |  .  .  .  .  .  .  .  .  .     to 'a' for the length of the line.  This
                                    works.  Thanks to Paul Leonard.

   -Rob


--- PPoint 1.32
 * Origin: Live from Hillsboro, OR (1:105/319.27)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET