Buzby
Senior Member
Hi All,
Inspired by laserhawk's sub hunter game project, I started to code an engine to do the bearing and range calculations.
The 08M2 is a bit sparse on trigonometry functions , but I have got half of the necessary code working.
In the diagram the original bearing is P and range is x.
R is the heading and y the distance of the target move.
C is the angle related to bearing and heading, calculated with 90' and 180' relationships from P and R.
z is the new range, calculated from x, y and cosine of C.
The problem now is to calculate the new bearing, P + Q, so I need to find Q.
I could calculate Q with another trig function, maybe sinQ=(y sinC)/z, but this needs both a sin and inverse sin table, and I've no room for two.
Are there any maths wizards out there who could tell me an easier way, or am I barking up completely the wrong tree doing it this way ?
Cheers,
Buzby
EDIT : Don't say use an X2, that's too easy !
View attachment SubHunter_1.bas
Inspired by laserhawk's sub hunter game project, I started to code an engine to do the bearing and range calculations.
The 08M2 is a bit sparse on trigonometry functions , but I have got half of the necessary code working.
In the diagram the original bearing is P and range is x.
R is the heading and y the distance of the target move.
C is the angle related to bearing and heading, calculated with 90' and 180' relationships from P and R.
z is the new range, calculated from x, y and cosine of C.
The problem now is to calculate the new bearing, P + Q, so I need to find Q.
I could calculate Q with another trig function, maybe sinQ=(y sinC)/z, but this needs both a sin and inverse sin table, and I've no room for two.
Are there any maths wizards out there who could tell me an easier way, or am I barking up completely the wrong tree doing it this way ?
Cheers,
Buzby
EDIT : Don't say use an X2, that's too easy !
View attachment SubHunter_1.bas
Last edited: