i haven't done the part for the completely 3-D version, but I have
written code for doing ranges on any geo map. I didn't read through
the entire post so i'm not sure if this code is relavant, and you
would have to have some type of lookup table for doing the range
calculation for specific types of missles otherwise you can enter in
best guesses for range, but this will draw a circle from a center
location to a specified range and can even do pie slices when an
azimuth and beamwidth are supplied. This particular function is
written in C# and works with the google earth api. I have the google
earth api wrapped in c# to do the javascript so you would have to
translate this to javascript, but that's not hard. also for
CoverageType you would have to specify if this if for omnidirectional
(circle) or a directional type (pie slice).
private const int DEGREES_IN_CIRCLE = 360;
private const int DEGREES_PER_POINT = 12; //arbitrary
default- allows no more than 30 points
private const int RADIUS_EARTH_KM = 6371; //average radius of
earth
private const int RADIUS_EARTH_MI = 3959;
private const int FEET_IN_MILE = 5280;
private const int YARDS_IN_MILE = 1760;
private const int METERS_IN_KM = 1000;
private IKmlLinearRing CalculateCoverageArea(double azimuth, double
beamwidth, double range, CoverageType coverageType, DistanceUnits
units)
{
IKmlLinearRing coverageArea =
_GoogleEarthHost.CreateLinearRing();
int numberOfPoints;
if (CoverageType == coverageType.Omni)
{
beamwidth = DEGREES_IN_CIRCLE;
azimuth = 0;
}
else
{
coverageArea.Coordinates.pushLatLngAlt(
Item.Position.Latitude, Item.Position.Longitude,
0);
azimuth = azimuth - (beamwidth/2);
}
double earthRadiusVal;
switch (units)
{
case DistanceUnits.Feet:
earthRadiusVal = RADIUS_EARTH_MI * FEET_IN_MILE;
break;
case DistanceUnits.Kilometers:
earthRadiusVal = RADIUS_EARTH_KM;
break;
case DistanceUnits.Meters:
earthRadiusVal = RADIUS_EARTH_KM * METERS_IN_KM;
break;
case DistanceUnits.Miles:
earthRadiusVal = RADIUS_EARTH_MI;
break;
case DistanceUnits.Yards:
earthRadiusVal = RADIUS_EARTH_MI*YARDS_IN_MILE;
break;
default:
earthRadiusVal = 1;
break;
}
numberOfPoints =
Convert.ToInt32(
Math.Ceiling((DEGREES_IN_CIRCLE/DEGREES_PER_POINT)
-
((DEGREES_IN_CIRCLE - beamwidth)/
DEGREES_PER_POINT)));
double lat1 = convertToRadians(Item.Position.Latitude);
double lng1 = convertToRadians(Item.Position.Longitude);
double degreesPerPoint = beamwidth/numberOfPoints;
double arcDistance = earthRadiusVal != 0 ? range /
earthRadiusVal : 1;
for (int i = 0; i < (numberOfPoints + 1); i++)
{
double angle = i * degreesPerPoint + azimuth;
angle = convertToRadians(angle);
double latitude =
Math.Asin(Math.Sin(lat1)*Math.Cos(arcDistance) +
Math.Cos(lat1)*Math.Sin(arcDistance)*
Math.Cos(angle));
double longitude = lng1 +
Math.Atan2(
Math.Sin(angle) *
Math.Sin(arcDistance) *
Math.Cos(lat1),
Math.Cos(arcDistance) -
Math.Sin(lat1) *
Math.Sin(latitude));
latitude = convertToDegrees(latitude);
longitude = convertToDegrees(longitude);
coverageArea.Coordinates.pushLatLngAlt(latitude,
longitude, 0);
}
return coverageArea;
}
private double convertToRadians(double angle)
{
return angle * Math.PI / 180;
}
private double convertToDegrees(double angle)
{
return angle * 180 / Math.PI;
> Koop and his Air Power Australia giga-site (
http://www.ausairpower.net/) (See Russian and People Liberation Army [PLA]