Understanding of the homogeneous coordinates __ graphics

Source: Internet
Author: User

The concept of homogeneous coordinates has not been fully understood, most of the book said that "homogeneous coordinates in the affine transformation is very convenient", then there is no later text, today in a blog called "300 Years of rebirth," read an article about perspective projection transformation, which has a very incisive alignment of the coordinates have a very good explanation, In particular, a strong proof of such a sentence: "Homogeneous coordinate representation is one of the important means of computer graphics, it can be used to distinguish between vectors and points, but also more easily for affine (linear) geometric transformations." "--f.s Hill, JR.

Because the author of the homogeneous coordinates really explain the good, I will excerpt from the intact:

For a vector v and a base oabc , a set of coordinates (V1,V2,V3) can be found, making v = v1 a + v2 B + v3 c (1 )

for a point p , you can find a set of coordinates (P1,P2,P3) so that p - o = P1 A + p2 b + p3 c ( 2),

From the above expression of vectors and points, we can see that in order to represent a point in the coordinate system (e.g. p), we look at the position of the point as a displacement of the origin o of the base, a vector--p–o (in some books the vector is called the position vector-the special vector starting at the origin of the coordinate), and we Expressing a point in the equivalent way while expressing the vector.

P:p = o + p1 A + p2 b + p3 C (3)

(1) (3) is a different expression of a vector and a point in the coordinate system. It can be seen here that although the vectors and points are expressed in the form of algebraic components, an additional message is required to express a point than a vector. If I write an algebraic component expression (1, 4, 7), who knows if it is a vector or a point.

We now write (1) (3) in the form of a matrix: v = (v1 v2 v3 0) X (a b c o)

p = (P1 p2 p3 1) X (a b c o), where (A,b,c,o) is the coordinate base matrix, and the right column vector is the coordinates of the vector v and the point p under the base. Thus, vectors and points have different expressions under the same base: The 4th algebraic component of the 3D vector is 0, and the 4th algebraic component of the 3D point is 1. Such a method of representing a 3D geometric concept with 4 algebraic components is a homogeneous coordinate representation.

So, the above (1, 4, 7) if written (1,4,7,0), it is a vector, if it is (1,4,7,1), it is a point. The following is how to convert between normal coordinates (ordinary coordinate) and homogeneous coordinates (homogeneous coordinate):

(1) When converting from normal coordinates to homogeneous coordinates

if (x,y,z) is a point, it becomes (x,y,z,1);

if (x,y,z) is a vector, it becomes (x,y,z,0)

(2) When converting from homogeneous coordinates to normal coordinates

If it is (x,y,z,1), know that it is a point and become (X,Y,Z);

If it is (x,y,z,0), know that it is a vector and still become (X,Y,Z)

The above is the way to differentiate vectors and points by homogeneous coordinates. It can be thought that, for the 3 most common affine transformations of translation T, rotation R, and scaling S, the translation transformation is only meaningful for points because the normal vector has no position concept, only size and direction.

While rotation and scaling are meaningful for both vectors and points, you can detect them with a similar representation of the above. It can be seen from this that the homogeneous coordinates are very convenient for affine transformation.

In addition, for a common coordinate point p= (Px, Py, Pz), there is a corresponding group of homogeneous coordinates (WPX, Wpy, Wpz, W), where w is not equal to zero. For example, the homogeneous coordinates of P (1, 4, 7) are (1, 4, 7, 1), (2, 8, 14, 2), (-0.1,-0.4,-0.7,-0.1), and so on. Therefore, if you turn a point from normal to homogeneous coordinates, multiply the x,y,z by the same zero W, then add the 4th component W, and if you convert a homogeneous coordinate to normal, divide the first three coordinates by the 4th coordinates and then remove the 4th component.

Since the homogeneous coordinates use 4 components to express the 3D concept, the translation transformation can be performed using matrices, thus making the affine (linear) transformation more convenient, as F.s Hill, JR said. Because the graphics hardware has generally supported homogeneous coordinates and matrix multiplication, it has promoted the use of homogeneous coordinates, making it seem to be a standard in graphics.

The above is a good explanation of the role of homogeneous coordinates and the advantages of using homogeneous coordinates. In fact, in the theory of graphics, many have been encapsulated the good API is also very research, want to become a professional computer graphics learners, in addition to know that it must also know why. In this way, in the face of problems in order to quickly locate the root causes of the problem, so as to solve the problem.

Another post introduction: http://www.cnblogs.com/kesalin/archive/2009/09/09/homogeneous.html problem: Two parallel lines will intersect
The rails intersect at a point infinitely far away.

In Euclidean geometry space, two parallel lines will never intersect. But in the projection space, the two rails on the right are intersecting at the horizon because they seem to intersect at a point in the infinite distance.

It is ideal to describe 2d/3d geometric objects in Euclidean (or Cartesian) space, but not in the projection space. We use (x, y) to represent a 2D point in the Cartesian space, while the point at infinity (∞,∞) is meaningless in the Cartesian space. The two parallel lines in the projection space intersect at a point in the infinity, but the Cartesian space cannot fix the problem (because the point in the infinity is meaningless in the Cartesian space), so the idea that mathematicians come up with homogeneous coordinates is coming. Solution: Second coordinate

The homogeneous coordinates (homogeneous coordinates) proposed by August Ferdinand Möbius allow us to perform image and geometry processing in the projection space, and the homogeneous coordinates use N + 1 components to describe n-dimensional coordinates. For example, 2D homogeneous coordinate is to add a new component W on the basis of Cartesian coordinates (x, y), which is (x, Y, W), in which the large x,y in the Cartesian coordinate system have the following relationship with the small x,y in the homogeneous coordinates:

X = x/w
Y = y/w

The points in Cartesian coordinates (1, 2) are in the homogeneous coordinates (1, 2, 1). If this moves to infinity (∞,∞), in the homogeneous coordinates (1, 2, 0), we avoid using meaningless "∞" to describe the infinitely distant point. Why is it called homogeneous coordinates.

As mentioned above, we get x and x in Cartesian coordinates, respectively, by dividing the X and y in the homogeneous coordinates by W, as shown in the figure:



Take a closer look at the conversion examples below to find something interesting:

In the diagram above, points (1, 2, 3), (2, 4, 6) and (4, 8, 12) correspond to the same point in Cartesian coordinates (1/3, 2/3). Any quantity product (1a, 2a, 3a) always corresponds to the same point in Cartesian coordinates (1/3, 2/3). So these points are "homogeneous" because they always correspond to the same point in Cartesian coordinates. In other words, the homogeneous coordinates describe scaling invariance (scale invariant). Proof: Two parallel lines can intersect

In the Cartesian coordinate system, for the following two linear equations:


If c≠d, the above equations have no solution; if C = D, then the two lines are the same line.

Here we use x/w, y/w instead of X, y in the projection space to solve:


Now we can get a set of solutions (x, y, 0) in C≠d, substituting (c-d) w = 0, because c≠d, so w = 0. Thus, two parallel lines intersect a point (x, y, 0) that is infinitely far away in the projection space.

The homogeneous coordinate is useful in computer graphics, and it is used in the process of projecting the three-dimensional scene into the 2D plane.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.