One of the basic concepts of 3D space: Point, vector, and homogeneous coordinate

Source: Internet
Author: User
Tags benchmark

1.Differences between points and Vectors

A point is an absolute coordinate in a three-dimensional space. Its value is based on the origin, and a vector is used to indicate the amount of force and speed with direction and size, it is usually represented by a line segment with length and direction. Although they all have three components, if a vector is placed in any position in the coordinate system (translation ), does not change its nature, because the vector represents the direction and size, and is irrelevant to the location distance. Its value is relative to the benchmark. It is a mathematical symbol of three-dimensional vertices and vectors, or a column matrix.

 In a two-dimensional planeCAndZSet0

2.Vector acquisition

Using the coordinates of two points can calculate the vector, assuming there are two points P1 and P2, with P1 as the reference point, vector V = P2-P1, if P2 as the reference point, then vector V = P1-P2, in short, V = P-Pb, Pb is the reference point.

V = P-Pb = (x-xb, y-yb, z-zb) = (a, B, c)

For example, if P1 = (, 3), P2 = (, 2) and P2 is considered as the benchmark, then the formula is as follows:

V = P1-P2 = (1---2) = (-, 1)

It can be seen that, although the three components of P1 and P2 are in the positive axis, the vector of V points to the negative axis of the x axis in the x direction because the reference point is P2, the B value of V is 0, so the vector is in an XZ plane,

 

Put V in coordinates

 

We can also see that no matter where the vector is, its direction and size will not change.

3.Absolute Value of a vector

The absolute value of a vector is the length of the vector, also known as the modulus. The formula is as follows:

 

In the preceding example, the component V is substituted into | V | = sqrt (-1 ^ 2 + 0 ^ 2 + 1 ^ 2) = sqrt (2) = 1.414...

4.Unit Vector

The unit vector is the vector with the modulo (vector length) of 1, that is, the vector of each unit length of a vector. The formula for calculating the unit vector u is:

 

Set| V | = LThe formula is broken down as follows:

= (A, B, c)/L

= (A/L, B/L, c/L)

= (Au, bu, cu)

Therefore, the Unit vector in the above example is:

U = (-1.414, 1)/1/1 = (-414. 1/1, 0, 414)

= (-0.707, 0, 0.707)

5.Homogeneous coordinates

In coordinate and vector calculation, in order not to confuse points and vectors, in addition, in geometric transformation, in order to speed up the computation and simplify the computation, matrices are often used, in matrix operations, the product of a matrix can only represent transformations such as rotation, ratio, and cut, but not translation transformations. Therefore, for unified calculation (the use of homogeneous coordinates is more significant in mathematics), the fourth component w is introduced, which makes the original two-dimensional coordinates become three-dimensional coordinates, similarly, the three-dimensional coordinates become four-dimensional coordinates, w is called a proportional factor. When w is not 0 (generally set to 1), it indicates a coordinate, three components of a three-dimensional coordinate x, y, z is represented as a four-dimensional space that changes to x, y, z, and w by homogeneous coordinates. It is converted into three-dimensional coordinates in the following way:X/w, y/w, z/wWhen w is 0, it indicates an infinite point in mathematics, that is, it is not a specific coordinate position, but a vector with size and direction. In this way, we can use the same system to represent two different quantities.

In OPENGL, when used as a coordinate point, w parameter is 1; otherwise, it is 0. In this way, all geometric transformations and vector operations can be performed using the same matrix product, when a vector and a matrix are multiplied, the result is also a vector.

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.