Bearing Calculation

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Bearing Calculation

Post by htuser »

Dear CSPro Development Team,
Following my idea to port existing calculation to CSPro designed application, i would like to know if i can port this: https://www.igismap.com/formula-to-find ... longitude/
or https://gis.stackexchange.com/questions ... -arduino-c
to CSPro logic. It's very important to have this since, i always use radio button lookup list in any census or survey. In this list, enumerators always have: Name, Surname, adresse, phone number, distance of all houselhold (head) that are affected to them. Right now, and want to add bearing.
Before me, other already need it:
http://csprousers.org/forum/viewtopic.php?f=6&t=980

I would be very easy to calculate if we could import and use http://www.cplusplus.com/reference/cmath/
in CSPro logic.

Thanks in advance for your support!
G.VOLNY, a CSProuser from Haiti, since 2004
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Bearing Calculation

Post by josh »

Back in the old days before calculators and computers people used tables to calculate trigonometric functions: https://www.analyzemath.com/trigonometr ... table.html

You could use the same technique in your CSPro program with arrays or lookup files to create your own sin, cos and atan functions. You could either copy the tables from the above website or generate your own in Excel. To use the table to compute the value of the function you find the closest angle in the table and then get the corresponding function value in that row i.e. for sin(x) you find the value closest to x in the first column (if using degrees or second column if using radians) and then get the value in the same row for sin. If you want to be more precise you could use linear interpolation between the two closest values although for what you are doing I don't think you would need that.
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Bearing Calculation

Post by htuser »

Thanks a lot Josh.
This should work.
I'll use excel to calculate them, since theses functions already exists in it.
However, in the future, for more complicated calculation and for more accuracy, it would be better to have the ability to use complete math library in CSPro Logic.
Best Regards,
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply