DEV Community

HandsomeTan
HandsomeTan

Posted on • Edited on

Homogeneous and Cartesian coordinates

In Computer Graphics, Cartesian coordinate is a common coordinate system, but for matrix calculation to be convenient we introduce Homogeneous coordinate system. The reasons are as below:
For a example of two-dimensional, assuming the position of a object is {x, y} and applying a translation operation to this object to obtain a new position: {x + tx, y + ty}, which is a manual calculation method. Matrix multiplication is a method used by computers for coordinate transformation, but whether to use tow-dimensional or three-dimensional, multiplication doesn't work on translation operation. So we bring in additional one dimension, whose value is usually 1, so the coordinate of object in two-dimensional is {x, y, w}. The conversion formula between homogeneous coordinates({x, y, w}) and Rectangular coordinates({X, Y}) is X = x/w, Y = y/w, Now we can use translation operation for martix multiplication:

Image description

in this way, all of transform opertions can be finished through matrix multiplication, thereby diminishing computational costs.
By the way, homogeneous coordinate also address the problem of two parallel lines intersecting. We assume the following situation:

Image description

this equation have no solution in Euclid space because they are parallel mutually. In Perspective space, we use homogeneous coordinate(x/w, y/w) instead of x,y:

Image description

there is a solution: (x, y, 0) represents thet intersection of two parallel lines at this point, which represents the position at infinity.


Retry later

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay