Liang-Barsky
参数方程
两点式:
换下位置,并设其等于
其中
则参数方程可表示为:
裁剪窗口不等式
(
不等式可表示为:
其中,
判定
条件 | 线的位置 |
---|---|
平行于裁剪边界 | |
完全在边界外 | |
在边界内 | |
线从外到内 | |
线从内到外 |
参数
若
Algorithm
- Set
. - Calculate the values of
( , , , ),
(a) If ignore that and move to the next edge.
(b) else separate the values as entering or exiting values using the inner product.
(c) If is entering value, set ; if is existing value, set . - If
, draw a line from to - If the line crosses over the window,
and are the intersection point of line and edge.
v1.5.2