not asking anyone to do it for me just start me off, so if anyone knows java and php wanna lend me a hand?
Code: Select all
package com.satfinder;
/**
*
* @author Administrator
*/
public class Complex {
private double x;
private double y;
public Complex(double x,double y) {
this.x = x;
this.y = y;
}
public double x() {
return x;
}
public double y() {
return y;
}
}Code: Select all
public class satFinder {
/** Creates a new instance of satFinder */
public satFinder() {
}
final double toDeg = 180.0/Math.PI;
final double toRad = Math.PI/180.0;
/*
*
* ComputePos(input: (earth) lat (deg), lng (deg),
* (satellite) satlng (deg),
*
* output: Complex(x = az true (deg), y = el (deg))
*
* az format: North = 0, East = 90, South = 180, West = 270
* el format: Horizontal 0, Vertical 90
*
*/
public Complex computePos(double lat, double lng, double satLng) {
double dlngr = (lng-satLng) * toRad;
double az = Math.atan2(Math.sin(lat * toRad),Math.tan(dlngr)) * toDeg;
az = (270.0 - az) / 360.0;
az = az - Math.floor(az);
az *= 360.0;
double r1=6.6107; // ratio synchronous orbit/earth radius
double clng = Math.cos(dlngr);
double clat = Math.cos(lat * toRad);
double v1=r1*clat*clng-1.0;
double v2=r1*Math.sqrt(1-clat*clat*clng*clng);
double el = Math.atan2(v1,v2) * toDeg;
return new Complex(az,el);
}
/*
*
* ComputeSkew(input: (earth) lat (deg), lng (deg),
* (satellite) satlng (deg),
*
* output: double skew (deg)
*
*/
private double computeSkew(double lat, double lng, double satLng) {
double dlngr = (satLng-lng) * toRad;
return (Math.atan2(Math.tan(lat * toRad),Math.sin(dlngr)) * toDeg) - 90.0;
}
}