irrlicht_0.1 Source Learning (6)-include/core/*

Source: Internet
Author: User

Because the main content of the core part of Irrlicht engine is a series of custom data structure and some important constants, it is very difficult to understand, after all, are some coding basic skills.

First open IRRMATH.H, which defines 4 constants in the core namespace: Error accuracy rounding_error for 32-bit floating-point comparisons, PI constant pi, and conversion coefficients grad_pi and grad_pi2 for each conversion of angle radians.

Then we open the heapsort.h, look at the file name can guess, this file should be used to implement the heap sorting function. Sure enough, only two heap sorting-related functions were implemented in the file: Heapsink and Heapsort.

Where the function heapsink is used to construct a maximum heap, and the function heapsort is to receive an array, internally by calling the function Heapsink to construct the received array as a maximum heap. Then we use the heap sorting algorithm to finish sorting the template array.

Then continue to see array.h This file, the file implements a dynamic array template class, built-in heap sorting, binary search, adding and removing elements, emptying arrays, dynamic management and other features.

In List.h, a doubly linked list template class is implemented.

In Irrstring.h, a string template class is implemented.

In Rect.h, the rectangle template class rect and the extended Rectangle template class Rectex are implemented, with the function of shape overlap detection. The main difference between the two template classes is that they have a different solid line, and Rect determines the size and position of the rectangle by the dimensions of a dimension2d object plus the upper-left coordinate of the Position2d object's identity. The extended template class, Rectex, determines the size and position of the rectangle in the upper-left and lower-right coordinates of the Position2d object's identity.

Line2d.h and line3d.h respectively encapsulate the definition of segment data structures in two-dimensional and three-dimensional spaces.

Vector2d.h and Vector3d.h respectively implemented two-dimensional vector and three-dimensional vector two data structures, and all realized the basic operations, such as: vector and scalar operations, vector-to-vector operations, rotation operations, units and so on.

Plane3d.h creates a planar template class and defines an enumeration of the intersection relationships of points/lines and planes. Plane3dex.h creates an extended flat template class that accelerates operations by adding a distance field, D, that describes the plane to the coordinates origin O. In the realization of these two planar classes, the characteristics of the intersection of the point French plane, the judgment plane and the specified point/Line are provided.

Aabbox3d.h file. An axis-aligned bounding box Aabbox3d class is implemented in this file, which specifies the bounding box size dimensions with the Minedge and Maxedge vectors.

In Matrix4.h, a 4×4 matrix template class is implemented, which is mainly used for various spatial conversion operations in 3D graphics operations.

irrlicht_0.1 Source Learning (6)-include/core/*

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.