Assembly:System.Numerics.Vectors.dll
Assembly:System.Numerics.dll
Assembly:netstandard.dll
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to lớn the information provided here.
Bạn đang xem: Quaternion và phép quay không gian
public value class Quaternion : IEquatablepublic struct Quaternion : IEquatabletype Quaternion = struct
Public Structure Quaternion
Implements IEquatable(Of Quaternion)Inheritance
Remarks
The Quaternion structure is used lớn efficiently rotate an object about the (x,y,z) vector by the angle theta, where:w = cos(theta/2)
Constructors
Quaternion(Single, Single, Single, Single) | Constructs a quaternion from the specified components. |
Quaternion(Vector3, Single) | Creates a quaternion from the specified vector & rotation parts. |
Fields
W | The rotation component of the quaternion. |
X | The X value of the vector component of the quaternion. |
Y | The Y value of the vector component of the quaternion. |
Z | The Z value of the vector component of the quaternion. |
Properties
Identity | Gets a quaternion that represents no rotation. |
Is Identity | Gets a value that indicates whether the current instance is the identity quaternion. |
Item | Gets or sets the element at the specified index. |
Zero | Gets a quaternion that represents a zero. |
Methods
Add(Quaternion, Quaternion) | Adds each element in one quaternion with its corresponding element in a second quaternion. |
Concatenate(Quaternion, Quaternion) | Concatenates two quaternions. |
Conjugate(Quaternion) | Returns the conjugate of a specified quaternion. |
Create From Axis Angle(Vector3, Single) | Creates a quaternion from a unit vector và an angle khổng lồ rotate around the vector. |
Create From Rotation Matrix(Matrix4x4) | Creates a quaternion from the specified rotation matrix. |
Create From Yaw Pitch Roll(Single, Single, Single) | Creates a new quaternion from the given yaw, pitch, & roll. |
Divide(Quaternion, Quaternion) | Divides one quaternion by a second quaternion. |
Dot(Quaternion, Quaternion) | Calculates the dot hàng hóa of two quaternions. |
Equals(Object) | Returns a value that indicates whether this instance và a specified object are equal. |
Equals(Quaternion) | Returns a value that indicates whether this instance và another quaternion are equal. |
Get Hash Code() | Returns the hash code for this instance. |
Inverse(Quaternion) | Returns the inverse of a quaternion. Xem thêm: Hiđro Hoá Hoàn Toàn Hỗn Hợp M Gồm Hai Anđehit X Và Y No, Đơn Chức |
Length() | Calculates the length of the quaternion. |
Length Squared() | Calculates the squared length of the quaternion. |
Lerp(Quaternion, Quaternion, Single) | Performs a linear interpolation between two quaternions based on a value that specifies the weighting of the second quaternion. |
Multiply(Quaternion, Quaternion) | Returns the quaternion that results from multiplying two quaternions together. |
Multiply(Quaternion, Single) | Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. |
Negate(Quaternion) | Reverses the sign of each component of the quaternion. |
Normalize(Quaternion) | Divides each component of a specified Quaternion by its length. |
Slerp(Quaternion, Quaternion, Single) | Interpolates between two quaternions, using spherical linear interpolation. |
Subtract(Quaternion, Quaternion) | Subtracts each element in a second quaternion from its corresponding element in a first quaternion. |
To String() | Returns a string that represents this quaternion. |
Operators
Addition(Quaternion, Quaternion) | Adds each element in one quaternion with its corresponding element in a second quaternion. |
Division(Quaternion, Quaternion) | Divides one quaternion by a second quaternion. |
Equality(Quaternion, Quaternion) | Returns a value that indicates whether two quaternions are equal. |
Inequality(Quaternion, Quaternion) | Returns a value that indicates whether two quaternions are not equal. |
Multiply(Quaternion, Quaternion) | Returns the quaternion that results from multiplying two quaternions together. |
Multiply(Quaternion, Single) | Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. |
Subtraction(Quaternion, Quaternion) | Subtracts each element in a second quaternion from its corresponding element in a first quaternion. |
Unary Negation(Quaternion) | Reverses the sign of each component of the quaternion. Quarternion được sử dụng trong phép quay không gian. Trong phần 1 này, tôi đã nói về phong thái sử dụng sơ lược của chính nó trong phép quay ko gian. Các bài viết khác vào loạt bài xích về quaternion: Quaternion được định nghĩa như là một vài phức có cha thành phần ảo: ![]() Đừng nghĩ đến quaternion là 1 trong những cái nào đấy bốn chiều, đầu bạn sẽ nổ tung. Các thành phần ảo ![]() ![]() Với ![]() ![]() Áp dụng vào phép quay không khí của bọn chúng ta. Mang sử các bạn có một vector trục con quay ![]() ![]() ![]() ![]() ![]() Ví dụ, bạn có nhu cầu tạo một phép tảo một góc 120 độ (tức 2/3 pi radian) xoay trục ![]() ![]() ![]() ![]() Và từ bỏ đó, chúng ta có quaternion có thể chấp nhận được quay là: ![]() Để triển khai phép quay, bạn cần một cái nào đó để quay. Lấy một ví dụ tôi có một điểm ![]() ![]() ![]() ![]() ![]() ![]() Trong đó ![]() ![]() ![]() ![]() ![]() Trong trường đúng theo này, nghịch hòn đảo bằng lượng phối hợp do trị tuyệt vời nhất của quaternion vào phép quay bằng 1. Nếu như bạn thắc mắc vì sao có công thức chuyển đổi quarternion, xin coi phần sau. Sau đó, bọn họ sẽ áp dụng phép nhân quartenion. Hãy ghi lưu giữ phép nhân quaternion không có tính giao hoán. Bạn có thể nghiên cứu giúp thêm về phép nhân quaternion trên đây. Trong blog này tôi chỉ nhắc tới hiệu quả của phép nhân. Cho 2 quaternion ![]() ![]() ![]() ![]() Sử dụng cách làm trên để dán vào ví dụ của họ (biến đổi ![]() ![]() ![]() ![]() Hinh mặt mô tả phép quay lấy ví dụ như của chúng ta. Bạn cũng có thể thấy nếu bọn họ quay xung quanh trục ![]() ![]() ![]() Vừa rồi tôi vừa mới ra mắt sơ lược về kiểu cách sử dụng quaternion trong phép quay. Vào phần sau, tôi sẽ nói đi sâu về phần toán, bài toán tối ưu hóa nó trong xây dựng và đối chiếu với những phép thay đổi khác. |