3D Game basic space ry (I) vector and Vertex

Source: Internet
Author: User

When I was a beginner at 3d, a concept had plagued me for a long time: What is vertex and what is vector ??

In the program, vertices and vectors are represented by the same type. Even discussed with others, the two are also mixed, so they were confused in the beginning.

In fact, vertices and vectors are different concepts.

Vertex: the location information in the space, that is, the coordinates of X, Y, and Z. It is usually represented by a triple (x, y, z, the transformation may be extended to homogeneous coordinates (x, y, z, W). In this case, W is extended for convenience of matrix calculation. Generally, W is 1. after the conversion, W may become a non-1 value. In this case, you need to perform the normalization action (x/W, Y/W, Z/W, w/w ), the geometric meaning of this action is to transform the homogeneous space of 4D into 3D space. This is similar to setting a component in the coordinates (x, y, z) of a 3D space to 1, and then converting it to the plane space of a 2D space. Vertices can be translated, rotated, or scaled.

Vector: it is also a triplet (x, y, z), but it represents a direction. That is, from the origin to (x, y, z. It has the length and direction attributes and has no location attributes. Therefore, it can have many parallel equal values. In its homogeneous coordinates (x, y, z, W), w takes 0. In this case, when 0 is used, the coordinates can be rotated and scaled, translation transformation is not allowed. Because the vector itself has no location attribute, it is meaningless to perform a translation transformation on it.

TIPS: the general transformation matrix is a composite matrix of the Rotation Transformation Matrix (divided into three different matrices X, Y, and Z axes), the scaling matrix, and the translation matrix. To compose a transformation matrix, multiply each matrix in the desired transformation order. This composite matrix is a 4x4 matrix. To make the matrix effective during the transformation of the vertices and vectors, they must be extended to the same space.

By: loo.tam@gmail.com

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.