Point Clipping:
Point Clipping is used to determining, whether the point is inside the window or not. For this following conditions are checked.
- x ≤ xmax
- x ≥ xmin
- y ≤ ymax
- y ≥ ymin
“Point clipping is a process which is used to define the point position.” The point is either inside the view pane (window) or outside the view pane.
In computer graphics, the computer screen work like a two-dimensional coordinate system. Each point does not need to be displayed inside the computer screen.
It includes two terms-
- Window: It means what to display?
- Clipping: It means discarding the portion that is outside the window.
Example: Let us have a view pane (window). The coordinates of the window are-
(xwmax, xwmin) - For X-axis of the window
(ywmax, ywmin) - For Y-axis of the window
Let us assume a point coordinate (P, Q). If the point lies inside the window, then there is no need to perform point clipping. But if the point lies outside the window, we need to perform clipping. We can understand it by the following equation-
xwmax <= P <= xwmin
ywmax <= Q <= ywmin
There are four conditions; if these four are satisfied, then the point lies inside the window. If anyone condition is not satisfied, then the point lies outside the window, it means we have to perform clipping on the point.
xwmin <= P
xwmax => P
ywmin <= Q
ywmax => Q
The (x, y) is coordinate of the point. If anyone from the above inequalities is false, then the point will fall outside the window and will not be considered to be visible.
Program1:
To implement Point Clipping:
Output:
Program2:
To implement point clipping with respect to rectangular window:
Output: