# Clip coordinates

The clip coordinate system is a homogeneous coordinate system in the graphics pipeline that is used for clipping.[1] In OpenGL, clip coordinates are positioned in the pipeline just after view coordinates and just before normalized device coordinates (NDC).[2]

Objects' coordinates are transformed via a projection transformation into clip coordinates, at which point it may be efficiently determined on an object-by-object basis which portions of the objects will be visible to the user. In the context of OpenGL or Vulkan, the result of executing vertex processing shaders is considered to be in clip coordinates.[2][3] All coordinates may then be divided by the ${\displaystyle w}$ component (the fourth component in homogeneous coordinates ${\displaystyle (x_{c},y_{c},z_{c},w_{c})}$, see below) in what is called the perspective division. This transformation puts the objects into normalized device coordinates.[citation needed]

More concretely, a point in clip coordinates is represented with four components,

${\displaystyle {\begin{pmatrix}x_{c}\\y_{c}\\z_{c}\\w_{c}\end{pmatrix}},}$

and the following equality defines the relationship between the normalized device coordinates ${\displaystyle x_{n}}$, ${\displaystyle y_{n}}$ and ${\displaystyle z_{n}}$ and clip coordinates,

${\displaystyle {\begin{pmatrix}x_{n}\\y_{n}\\z_{n}\end{pmatrix}}={\begin{pmatrix}x_{c}/w_{c}\\y_{c}/w_{c}\\z_{c}/w_{c}\end{pmatrix}}.}$

Clip coordinates are convenient for clipping algorithms as points can be checked if their coordinates are outside of the viewing volume. For example, a coordinate ${\displaystyle x_{c}}$ for a point is within the viewing volume if it satisfies the inequality ${\displaystyle -w_{c}\leq x_{c}\leq w_{c}}$.[4] Polygons with vertices outside of the viewing volume may be clipped to fit within the volume.