"Mathematical Correlation" of "3D Development Notes" (i): Coordinate system

Source: Internet
Author: User

Now start to learn 3D basic knowledge, this series of mathematics related notes are based on reading books "3D Mathematical Fundamentals: Graphics and Game development", to achieve code using AS3, Project address is: https://github.com/hammerc/ HAMMERC-SNAKE3D-AS3 and Https://github.com/hammerc/hammerc-Snake3D-as3-examples, and the class library code is written in imitation of Away3d's design, The implementation on the best possible imitation of Away3d, some of the changes in the local learning notes will be described in particular.

To start with, look at the 2D, for the Cartesian coordinate system of 2D, there are 8 ways to express:

If n is the y-axis and E represents the x-axis, then the general 2D coordinate system chooses the second column of the second row (such as the coordinate system in flash), and the2D coordinate system has a feature that can be rotated into any representation by using any representation.

When we add another axis into the 3D coordinate system?

Left-hand coordinate system and right-hand coordinate

In a 3D Cartesian coordinate system, representations become 48, and one representation cannot be represented by rotating arbitrary transformations.

However, if it is divided into 24 left-handed representation and 24 right-handed representation, in the left-handed or right-handed coordinate system, the law of 2D is still working, that is, no matter how to use any representation can be rotated into any representation.

Let's look at the picture below:

The book uses a left-handed coordinate system, (which means: +x,+y,+z points to the right, above, ahead), and Away3d also uses the left-handed coordinate system, and my small class library uses the left-handed coordinate system together.

In addition, the current very fire Unity3d is also used in the left-handed coordinate system, but the left-hand and right-handed coordinate system is not good or bad, but in computer graphics generally use the left-handed coordinate system, and in linear algebra more inclined to use the right-hand coordinate system.

If we are dealing with some operations or using 3D modeling software, we need to take a special look at whether the coordinate system used is consistent with what we use, otherwise it will result in incorrect results.

Of course, the conversion of the left-handed and right-handed coordinate systems is also very simple, generally speaking, we just change the direction of any one axis in reverse.

Multi-coordinate system

We do not use only one coordinate system in actual use, but usually use more than one coordinate system, let us take a concrete look at the following:

coordinate system nesting

We can start from 2D space, in the 2D display list of Flash is a tree structure, each display object will have a set of their own coordinate system, which is called coordinate system nesting, then in 3D is the same situation.

World coordinate system

The world coordinate system represents the most rooted coordinate system in the current space, which can be understood as the stage or root object in flash2d, and the world coordinate system can be considered an absolute coordinate system.

Object coordinate system

That is, the coordinate system of each display object, which can be considered a local or relative coordinate system. In simple terms, if there is a person in the world coordinate system, we tell him to "go forward" is to be handled according to his local coordinate system, the direction of the person is different, the direction of the walk is different, but for him is to go forward, and if he "go eastward", it is in the world coordinates, regardless of the direction of the person, Should be the Orient to the world coordinate system.

Camera coordinate system

Camera coordinate system can be regarded as a special object coordinate system, the problem that the camera solves is how to display the object in 3D space correctly to the screen (2D space).

Inertial coordinate system

The inertial coordinate system is an auxiliary coordinate system, which is designed to simplify the conversion between two coordinate systems. The inertial coordinate system is always parallel to the world coordinate system, that is, it only represents the translation of the object coordinate system relative to the world coordinate system, regardless of the rotation of the object coordinate system, simplifying multiple operations.

"Mathematical Correlation" of "3D Development Notes" (i): Coordinate system

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.