# Algorithm for calculating line of sight [closed]

I've been working on implementing a Line of Sight calculation tool, but the results often appear incorrect. I am unable to use other libraries or tools to do the calculations, so please do not recommend any.

It is my understanding that the basic algorithm for calculating visibility between two points is:

1. Gather many points along the line (preferably equidistant from one another)
2. For each point on the line, calculate the viewing angle between it and the starting point.
3. For each point(P) on the line, visit each point that came before it(P') and if any point P' has a viewing angle greater than the viewing angle of P, then that point P is not visible.

It seemed straight forward, but I am getting incorrect visualizations. Is there anything wrong with my assumption on how to calculate visibility between the various points on a line?

(In order to calculate the viewing angle between points, I am using the method outlined here.)

• You don't have any code here. How can we know how you're implementing it to know what's wrong? May 18 at 0:34
• I didn't post any code because I don't even know if the steps I outlined are correct, so posting code would be meaningless? If I knew that the algorithm was correct, I'd be asking the question in a programming stack exchange. May 18 at 0:43
• Why can't you use other tools? If you are writing code you are using other libraries (tools). What makes this task so special? Maybe this paper will help?: asprs.org/wp-content/uploads/pers/2000journal/january/…
– GBG
May 18 at 14:58
• I can't use other libraries because it's not up to me. If it were, I'd be using the latest version of geos and not asking questions here. I'll take a look at the linked paper, thank you ! May 18 at 17:14