Content deleted Content added
inserted the c++ code implementation of liang barsky |
No edit summary |
||
Line 26:
# For nonzero <math>p_k</math>, <math>u = \frac{q_k}{p_k}</math> gives the intersection point.
# For each line, calculate <math>u_1</math> and <math>u_2</math>. For <math>u_1</math>, look at boundaries for which <math>p_k < 0</math> (i.e. outside to inside). Take <math>u_1</math> to be the largest among <math>\left\{ 0,\frac{q_k}{p_k} \right\}</math>. For <math>u_2</math>, look at boundaries for which <math>p_k > 0</math> (i.e. inside to outside). Take <math>u_2</math> to be the minimum of <math>\left\{ 1, \frac{q_k}{p_k} \right\}</math>. If <math>u_1 > u_2</math>, the line is outside and therefore rejected.
==See also==
Algorithms used for the same purpose:
|