-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AbdulRehmanFaraj
committed
Apr 13, 2014
1 parent
2d42fce
commit 5dcdb90
Showing
19 changed files
with
21,232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Background image taken from http://sambees.deviantart.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import javax.vecmath.Vector3d; | ||
|
||
/** | ||
* | ||
* @authors AbdurRehman & Ted & Mat | ||
* Sat object which describe it's orbit... | ||
*/ | ||
|
||
public class Sat extends GravityObject { | ||
|
||
private final double normliseFactorS = 11.0E06; | ||
private int ID; | ||
public Sat(){} | ||
public Sat(double a, double b, int id) | ||
{ | ||
super(); | ||
this.ID = id; | ||
this.semiMajorAxis = a; | ||
this.semiMinorAxis = b; | ||
this.theta = Math.random() * ( 6.28 - 0); | ||
this.setPeriodT(this.semiMajorAxis, this.semiMinorAxis); | ||
this.phaseDif = Math.random() * (this.periodT - 0 ) ; | ||
} | ||
|
||
/** | ||
* Get the Positions!! z is always 1 | ||
* @param time double | ||
* @return Vector3 positions | ||
*/ | ||
public Vector3d getPositions(double t) | ||
{ | ||
|
||
double xDash = this.getX(t + this.phaseDif) * Math.cos(theta) + this.getY(t + this.phaseDif) * Math.sin(theta); | ||
double yDash = -this.getX(t + this.phaseDif) * Math.sin(theta) + this.getY(t + this.phaseDif) * Math.cos(theta); | ||
Vector3d temp = new Vector3d(xDash, yDash, 1); | ||
return temp; | ||
} | ||
|
||
private void setPeriodT(double a, double b) | ||
{ | ||
this.periodT = 2*Math.PI * Math.sqrt((Math.pow(this.semiMajorAxis, 3)/MU)); | ||
System.out.println(" \nPeriod: " + this.periodT+ "\n"); | ||
} | ||
|
||
/* | ||
* returns C positions | ||
* @param double t // for current time you want to find the position | ||
*/ | ||
public double getY(double t) | ||
{ | ||
this.currentTime = t; | ||
this.yPosition = | ||
(this.semiMinorAxis * Math.sin((this.currentTime/this.periodT)*2*Math.PI)) / (2 * this.normliseFactorS) ; | ||
|
||
return this.yPosition; | ||
} | ||
|
||
/* | ||
* returns C positions | ||
* @param double t // for current time you want to find the position | ||
*/ | ||
public double getX(double t) | ||
{ | ||
this.currentTime = t; | ||
//Calculating X axis | ||
this.xPosition = | ||
( Math.sqrt( Math.pow(this.semiMajorAxis, 2) - Math.pow(this.semiMinorAxis, 2)) | ||
+ this.semiMajorAxis * Math.cos((this.currentTime/this.periodT)*2*Math.PI) ) / (2 * this.normliseFactorS); | ||
return this.xPosition; | ||
} | ||
|
||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.