Anonymous user
Ray-casting algorithm: Difference between revisions
m
→{{header|REXX}}: added a "swap" comment.
m (→{{header|REXX}}: corrected a typo, changed some comments.) |
m (→{{header|REXX}}: added a "swap" comment.) |
||
Line 2,565:
ray_intersect: procedure expose point. poly.; parse arg ?,s; sp=s+1
epsilon='1e' || (digits()%2); infinity='1e' || (digits()*2)
Px=point.?.x;
if Ay>By then parse value Ax Ay Bx By with Bx By Ax Ay
if Py=Ay | Py=By then Py=Py+epsilon
if Py<Ay | Py>By | Px>max(Ax,Bx) then return 0
if Px<min(Ax,Bx) then return 1
if Ax\=Bx then m_red =(By-Ay)/(Bx-Ax)
else m_red =infinity
if Ax\=Px then m_blue=(Py-Ay)/(Px-Ax)
else return 1
|