Ray-casting algorithm: Difference between revisions
Content added Content deleted
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: | Line 41: | ||
B : the end-point of the segment with the greatest y coordinate |
B : the end-point of the segment with the greatest y coordinate |
||
(B must be "above" A) |
(B must be "above" A) |
||
'''if''' Py |
'''if''' Py = Ay '''or''' Py = By '''then''' |
||
Py ← Py + ε |
|||
'''end''' '''if''' |
|||
'''if''' Py > Ay '''or''' Py < By '''then''' |
|||
'''return''' false |
'''return''' false |
||
'''else''' '''if''' Px > max(Ax, Bx) '''then''' |
'''else''' '''if''' Px > max(Ax, Bx) '''then''' |
||
Line 67: | Line 70: | ||
'''end''' '''if''' |
'''end''' '''if''' |
||
( |
(To avoid the "ray on vertex" problem, the point is moved upward of a small quantity ε) |
||