Bagikan melalui


Math Overview

Overview of the math related functionality provided by the XNA Framework.

The XNA Framework provides classes and methods dealing with these topics.

  • Vector Manipulation
  • Matrix Creation and Manipulation
  • Testing for Intersection and Containment of Geometry
  • Mathematical Constants and Scalar Manipulation

Vector Manipulation

The XNA Framework provides the Vector2, Vector3, and Vector4 classes for representing and manipulating vectors. Each vector class has methods for performing standard vector operations such as dot product, cross product, normalization, transformation, and interpolation.

Matrix Creation and Manipulation

The XNA Framework provides the Matrix class for transformation of vectors. The Matrix class provides methods for performing standard matrix operations such as addition, subtraction, and multiplication, in addition to helper methods for creating scale, translation, and rotation matrices.

Testing for Intersection and Containment of Geometry

The XNA Framework provides the BoundingBox, BoundingFrustum, BoundingSphere, Plane, and Ray classes for representing world geometry. These classes have methods for checking for intersection and containment with each other.

Mathematical Constants and Scalar Manipulation

The XNA Framework provides the MathHelper class for manipulating scalar values and retrieving some common mathematical constants. The MathHelper class also has utility methods for converting between degrees and radians.