Line Clipping - Skala

Skala

This algorithm is based on homogeneous coordinates and duality. It can be used for line or line segment clipping against a rectangular window as well as against a convex polygon. The algorithm is based on classifying a vertex of the clipping window against a half-space given by a line p: ax+by+c=0. The result of the classification determines the edges intersected by the line p. The algorithm is simple, easy to implement and extensible to a convex window as well. The line or line segment p can be computed from points x1, x2 given in homogeneous coordinates directly using the cross product as
p = x1 x x2 = x or as
p = x1 x x2 = x if given in the Euclidean coordinates.

Read more about this topic:  Line Clipping