Calculating Angles

 BBS: Inland Empire Archive
Date: 06-26-92 (01:17)             Number: 1342
From: PAUL LEONARD                 Refer#: NONE
  To: MIKE THAYER                   Recvd: NO  
Subj: Calculating Angles             Conf: (2) Quik_Bas
On or about <Jun 23 07:46>, Mike Thayer (1:271/29) scribbled:
 MT>         The Problem is in figuring the angle. Does anyone know of a
 MT>  way to calculate an angle given two points on the screen? That is if
 MT>  we can assume that horizon is 0 degrees?

You need at least three points to define any given angle
(except 0, 90, 180, 270, etc.).  So, i'll assume you mean
given any two points, what is the angle between the line
they define and the horizontal axis?

             .(x2,y2)
           / |
         /   |
       /     |
      .)a_____
      (x1,y1)

tan(a)=(y2-y1)/(x2-x1)

or

a=arctan((y2-y1)/(x2-x1))

ptl


--- msged 2.07
 * Origin: PTL Pointwork (1:105/48.111)
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