Content deleted Content added
Line 23:
Point current_point = inputList[i];
Point prev_point = inputList[((i % inputList.count) + inputList.count) % inputList.count];
Point Intersecting_point = ComputeIntersection(prev_point,current_point,clipEdge)
if (current_point inside clipEdge) then
if (prev_point not inside clipEdge) then
Line 35:
outputList.add(Intersecting_point);
end if
done
done
The vertices of the clipped polygon are to be found in ''outputList'' when the algorithm terminates. Note that a point is defined as being ''inside'' an edge if it lies on the same side of the edge as the remainder of the polygon. If the vertices of the clip polygon are consistently listed in a counter-clockwise direction, then this is equivalent to testing whether the point lies to the left of the line (left means ''inside'', while right means ''outside''), and can be implemented simply by using a [[cross product]].
|