Jump to content

Ray-casting algorithm: Difference between revisions

m
a slightly better pseudo (correction for the vertex problem), and a typo fix (By instead of B)
m (→‎{{header|C}}: removed old-work comments; alignment of \ into define)
m (a slightly better pseudo (correction for the vertex problem), and a typo fix (By instead of B))
Line 41:
B : the end-point of the segment with the greatest y coordinate
(B must be "above" A)
'''if''' Py = Ay '''or''' Py = BBy '''then'''
Py ← Py + ε
'''end''' '''if'''
'''if''' Py > Ay '''or''' Py < By '''then'''
'''return''' false
'''else''' '''if''' Px > max(Ax, Bx) '''then'''
Line 67 ⟶ 70:
'''end''' '''if'''
 
(AsTo it can be seen, ifavoid the "ray passes through aon vertex, it is not considered intersection; there exists a set of "situations" where this behaviour brings to wrong results; to avoid thisproblem, we should "move" the point upis ormoved downupward byof a small quantity &epsilon;)
 
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.