tse1.jpg (16422 bytes)

      
NASA logo

 

Webmaster:
Jason Hinds

Responsible NASA Official:
Mike Kincaid

Website Notices and Disclaimers

Final Project

Dane S.

Legislator:  Zeb Zbranek, Representative

Triangular Plotting

In order to continue our exploration of space we must have the capability to not get lost.  In order to not get lost we must have a mathematically proven course to your destination.  The way we will find this course is by using a method called triangular plotting.  Triangular plotting is a method that places an imaginary plane on three points, the earth satellite, your location, and your destination.

All calculations will be done by computer, and all measurements will be done by computers and satellites.  The satellite in orbit around the Earth will send a ping to the ship and calculate the ship's distance from the Earth.  Once the computer receives the desired destination it will relay a signal to the destination and find it's angle with the ship.  The angle will be based on the plane previously mentioned.  The distance to the location will be solved or will just be concluded from previous observations or plotting.

In order for the ship to use any of this data the front of the ship must be pointed at the Earth and it's bottom parallel to the plane, to make the angles useful to correct ships course The calculations of the ship's distance from the destination and the angle from the ship to the destination will be calculated using the formula:

dist = distance

                                                   A

                                                / \

                                          d1 /    \ d2

                                             /____\

                                           B            d3  C

                             

         d3 squared = d1 squared + d2 squared - (2)(d1)(d2 )(cos angle A)

This program will be used on all interstellar ships.  Using this method allows for plotting of straight lines in space making navigation easier.  To think about the complexity of space can boggle even the strongest of minds, but if you can center you thinking on only a few objects it makes plotting much easier.

The program that will be included with this final project requires user input on angle between the distance between earth and both other coordinates along with the distances between the Earth and the destination and the time it took the ping to reach the ship.  Good test data for this program is:

            .001 for the ping time in minutes

            15 for the distance between the Earth and you destination in kilometers

            150 degrees for the angle between the distance between Earth and the destination

                  and the distance between the Earth and your location.

            *if you solve it on paper you should get:

                        for the distance between your location and your destination 19.491122133

                        for the angle of change 22.63074013

                        for the distance between the Earth and you location 5

The programming language I used though has many faults, I will include the code I used for this program, but the program rounds big numbers and causes errors only really big numbers and the bigger the number the further the answer is going to be off.  But with a better language this errors would not exist.

I must give credit to my Pre-Calculus teacher, Mrs. Lewis for helping  with my math and reintroducing me to some old formulas.

code:

//Author:  Dane Schilling

//

//This program will be used to display the most direct line of travel from

//one location in the universe to another, using a method call triangular

//plotting.

//*NOTE* If this program would be put into use all inputed data would be relayed

//       via computer without actual user input, also all calculations on angles

//       will be based off of a plane that will be drawn on three points, the

//       earth, the destination, and you location.

//

//----------------------------abbreveations-------------------------------------

//

//dest = destination

//loc = your current location

//dis = distance

//var = variable

//j,i = is used to count

//

//-------------------------------library files----------------------------------

 

#include<iomanip.h>

#include<math.h>

#include<conio.h>

#include<stdlib.h>

#include<stdio.h>

 

//---------------------------------declarations---------------------------------

 

long double ping_time, loc_distance, dest_distance, route_distance,

                                                earth_angle, angle, var1, var2,            i;

 

//functions

void flash_screen();            //shows a prety title screen and then gives the get_data

                                                                                    //screen a heading

void clear_vars();   //clears all variables

void get_data();     //gets data from user then puts it into calculations

void calc();                                 //performs calculations and sends them to be displayed

void display();                //displays results

 

//------------------------------------main--------------------------------------

 

void main()

{

            //calls functions in order

            flash_screen();

            clear_vars();

            get_data();

}

 

//---------------------------flash_screen----------------------------------------

//shows a prety title screen and then gives the get_data screen a heading

//---------------------------flash_screen----------------------------------------

 

void flash_screen()

{

 

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"------*-----------*--------*-----*---------------------------------*---*-"<<endl;

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"------*-----------*--------*-----*---------------------------------*---*-"<<endl;

            cout<<"--------------*--------------*-----------------*----------*--------------"<<endl;

            cout<<"-*-----*--------------*------*-------*-------------*--------------*------"<<endl;

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"=======TTTTT RRRRR IIIII AAAAA N   N GGGGG U   U L     AAAAA RRRRR =

                       ====="<<endl;

            cout<<"=======  T   R   R   I   A   A NN  N G     U   U L     A   A R   R ======"<<endl;

            cout<<"=======  T   RRRRR   I   AAAAA N N N G  GG U   U L     AAAAA RRRRR ===

                       ==="<<endl;

            cout<<"=======  T   R RR    I   A   A N  NN G   G U   U L     A   A R RR  ======"<<endl;

            cout<<"=======  T   R   R IIIII A   A N   N GGGGG UUUUU LLLLL A   A R   R ======"

                  <<endl;

            cout<<"------*-----------*--------*-----*---------------------------------*---*-"<<endl;

            cout<<"=======      PPPPP L     OOOOO TTTTT TTTTT IIIII N   N GGGGG       ======"

                  <<endl;

            cout<<"=======      P   P L     O   O   T     T     I   NN  N G           ======"<<endl;

            cout<<"=======      PPPPP L     O   O   T     T     I   N N N G GGG       ======"<<endl;

            cout<<"=======      P     L     O   O   T     T     I   N  NN G   G       ======"<<endl;

            cout<<"=======      P     LLLLL OOOOO   T     T   IIIII N   N GGGGG       ======"

                  <<endl;

            cout<<"-*-----*--------------*------*-------*-------------*--------------*------"<<endl;

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"------*-----------*--------*-----*---------------------------------*---*-"<<endl;

            cout<<"--------------*--------------*-----------------*----------*--------------"<<endl;

            cout<<"-*-----*--------------*------*-------*-------------*--------------*------"<<endl;

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"--------*---------------*--------------*----------------*-------------*--"<<endl;

            cout<<"------*-----------*--------*-----*---------------------------------*---*-"<<endl;

 

 

            //shows screen for a few seconds

            for(i = 0; i < 22500000; ++i)

            {

            }

 

            //clears screen

            clrscr();

 

            //shows title

            cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<setw(45)<<"Triangular Plotting"

                  <<endl;

            cout<<"------------------------------------------------------------------------"<<endl<<endl;

 

}

 

//----------------------------------clear_vars----------------------------------

//clears all variables

//----------------------------------clear_vars----------------------------------

 

void clear_vars()

{

            //clears all vars for new calculation

            var1 = 0;

            var2 = 0;

            ping_time = 0;

            loc_distance = 0;

            dest_distance = 0;

            route_distance = 0;

            earth_angle = 0;

            angle = 0;

            i = 0;

}

 

 

 

 

//----------------------------------get_data------------------------------------

//gets data from user then puts it into calculations

//----------------------------------get_data------------------------------------

 

void get_data()

{

            cout<<"Time took to receive ping from the Earth in minutes: ";

            cin>>ping_time;

            cout<<endl<<"What is your destinationss distance from Earth in kilometers:  ";

            cin>>dest_distance;

            //*Note - this angle will be delivered to the program from the machine that

            //        recieves the ping,locates the destination and calculates the angle.

            cout<<endl;

            cout<<"Please input the angle between your location and your destination";

            cout<<endl<<"relative to Earth in degrees:  ";

            cin>>earth_angle;

 

            calc();

}

 

//------------------------------------calc--------------------------------------

//performs calculations

//------------------------------------calc--------------------------------------

 

void calc()

{

 

            //solves for the distance between your location and the Earth

            loc_distance = (ping_time/60) * 3 * 100000;

 

            //converts angle to radians

            earth_angle = (earth_angle * 3.141592654) / 180;

 

            //solves first for distance of the other triangle side then finds the missing angle

            var1 = sqrtl((powl(loc_distance , 2) + powl(dest_distance , 2) - (2 * loc_distance *

                      dest_distance * cosl(earth_angle))));

            var2 = (powl(dest_distance , 2) - powl(loc_distance , 2) - powl(var1 , 2)) / (-2 * var1 *

                      loc_distance);

 

            //finds the cos^-1 of the answer

            if(cosl(i) != var2)

            {

                        do

                        {

                                    i = i + .0001;

                        }

                        while(!(cosl(i) < var2 && cosl(i) < var2));

            }

            //sets i to angle

            angle = i;

 

            //converts angle into degrees

            angle = (angle * 180) / 3.141592654;

 

            clrscr();

            display();

}

 

//-------------------------------------display----------------------------------

//displays results

//-------------------------------------display----------------------------------

 

void display()

{

            cout<<endl<<endl<<endl<<endl<<endl<<endl;

 

            cout<<setw(40)<<"Results"<<endl;

            cout<<"------------------------------------------------------------------------";

            cout<<endl<<endl;

            cout<<"Your location is "<<loc_distance<<" kilometers from Earth"<<endl<<endl;

            cout<<"The distance between you and your destination is "<<var1<<endl;

            cout<<"kilometers."<<endl<<endl;

            cout<<"The angle of correction you need to make is ";

            cout<<angle<<" degrees"<<endl<<"to reach your destination."<<endl;

}

 

//-----------------------------------------end----------------------------------

 


Contact Information

Last Updated:  09/10/01