0
votes

I want to generate a vector of spherical (Earth) coordinates that would draw an arc given center location (in longitude latitude), radius (in meters), azimuth, and angle width (in radians).

My code:

double left = azimuth - width * .5;
double right = azimuth + width * .5;
double angleStep = 0.05;
std::vector<double> arcPointsX, arcPointsY;

for (double f = left; f <= right; f += angleStep) {   
    arcPointsX.push_back(x + radius * (double)cos(f));
    arcPointsY.push_back(y + radius * (double)sin(f));
}

This produces arcs however, these arcs are not facing the correct direction when I draw them though.

Thanks for help!

1
How are you using xa1, ya1, xa2, and ya2?R Sahu
same way as arcPointsX and arcPointsY, they should not really be there, I will modify the code.Jana
What are X and Y? You seem to be drawing an arc in the plane passing through the equator, not the surface of the Earth.Beta
X,Y is the circle center location in longitude latitudeJana
You're trying to do too much at once. Are you comfortable with coordinate conversions between spherical (lat, lon) and Cartesian (x,y,z)?Beta

1 Answers

1
votes

It turned out the problem was I had sin/cos the other way around. Using this gives me correct arcs:

arcPointsX.push_back(x + radius * (double)sin(f));
arcPointsY.push_back(y + radius * (double)cos(f));