Reputation: 1311
I'm trying to program a formula to calculate the new angle when drawing an Arc. It might be better if I explained it with a picture.
Above is a picture of what I'm drawing on google earth.
Currently I have a function that draws an Arc given a (x,y) pivot point, the bearing and the distance of the radius
After drawing this Arc (which is the farthest Arc from the origin) on the plot, I need to move the origin point, eg. If bearing was 170 degrees, the left line would start at 170-90 and the right one at 170+90
I'm having trouble finding out the formula for the angle (or bearing) that is in the smaller concentric circles. I would like to thank anyone in advance for any help that you can provide.
Here is my formula for calculating and drawing an Arc
def drawArc(lat1,lon1,lbearing,rbearing,hr): #draw Arc given lat/lon piviot point with the right and left bearing to draw the path and distance
arcstr=""
if rbearing < lbearing: #if the left bearing is already bigger than the right bearing, switch places. Test Case not proven yet! with winds coming from the east
lbearing,rbearing = rbearing,lbearing
while lbearing < rbearing:
arc1,arc2 = getEndpoint(lat1,lon1,lbearing,hr) #arc1 and arc2 are lat and lon respectively
arcCoord = "%f,%f,0\n"%(arc2,arc1)
arcstr+=arcCoord
lbearing+=1 #count
#attach the last remaining point which is the end point at the right bearing
arc1,arc2 = getEndpoint(lat1,lon1,rbearing,hr) #arc1 and arc2 are lat and lon respectively
arcCoord = "%f,%f,0\n"%(arc2,arc1)
arcstr+=arcCoord
return arcstr
To draw the three Arcs, here is where the function is called:
arc3=drawArc(latitude,longitude,leBearing,reBearing,arc3hr)
arc2=drawArc(latitude,longitude,leBearing-(SOME FORMULA TO GIVE ME THE EXTRA ANGLE/BEARING TO INTERSECT WITH THE OUTER LINE),reBearing+(SAME FORMULA HERE),arc2hr)
arc1=drawArc(latitude,longitude,leBearing-(SOME FORMULA TO GIVE ME THE EXTRA ANGLE/BEARING TO INTERSECT WITH THE OUTER LINE),reBearing+(SAME FORMULA HERE),arc1hr)
Known Points on this picture:
Origin point in lat/lon
Distance and bearing of each line
Radius of Inner Circle at origin is 10 NM and outer circle is 20NM
Here is a simplified picture, I believe angle theta is what I'm looking for
Upvotes: 1
Views: 732
Reputation: 1376
Here's the necessary geometry, assuming I interpreted your description and picture correctly. The image below (and linked) shows your picture with the variables we need to solve for theta.
Now, the math. This makes use of the law of sines/cosines.
Law of cosines gives us:
So we must solve for h, g, and f and then take the inverse cosine of the result to get theta.
And by law of sines...
We can solve for a immediately with law of cosines:
To find the lengths of segments x_1 and x_2, we need the angles theta_1,2,3...
Using these angles and more law of sines gives us x_1 and x_2...
Put this all together and you get
Just take of this mess after substituting the proper value for which depends on your choice of d (or DIST). I won't bother writing it here.
Upvotes: 1