X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=SlimDXc_Jun2010%28VC%2B%2B2008%29%2Fsource%2Fmath%2FQuaternion.h;fp=SlimDXc_Jun2010%28VC%2B%2B2008%29%2Fsource%2Fmath%2FQuaternion.h;h=0000000000000000000000000000000000000000;hb=d3453b257c2faf4db202d38666a872929ff220cd;hp=d4b57d515e86ee02ad4a3810b0b7ac80ca7e44f3;hpb=1c2eac207d4963c6bc170b3f7fbe0feeffcd17e0;p=dtxmania%2Fdtxmania.git diff --git a/SlimDXc_Jun2010(VC++2008)/source/math/Quaternion.h b/SlimDXc_Jun2010(VC++2008)/source/math/Quaternion.h deleted file mode 100644 index d4b57d51..00000000 --- a/SlimDXc_Jun2010(VC++2008)/source/math/Quaternion.h +++ /dev/null @@ -1,557 +0,0 @@ -/* -* Copyright (c) 2007-2010 SlimDX Group -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -* THE SOFTWARE. -*/ -#pragma once - -#include "../design/QuaternionConverter.h" - -using System::Runtime::InteropServices::OutAttribute; - -namespace SlimDX -{ - value class Matrix; - value class Vector3; - - /// - /// Defines a four dimensional mathematical quaternion. - /// - /// D3DXQUATERNION - [System::Serializable] - [System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential )] - [System::ComponentModel::TypeConverter( SlimDX::Design::QuaternionConverter::typeid )] - public value class Quaternion : System::IEquatable - { - public: - /// - /// Gets or sets the X component of the quaternion. - /// - /// The X component of the quaternion. - float X; - - /// - /// Gets or sets the Y component of the quaternion. - /// - /// The Y component of the quaternion. - float Y; - - /// - /// Gets or sets the Z component of the quaternion. - /// - /// The Z component of the quaternion. - float Z; - - /// - /// Gets or sets the W component of the quaternion. - /// - /// The W component of the quaternion. - float W; - - /// - /// Initializes a new instance of the structure. - /// - /// The X component of the quaternion. - /// The Y component of the quaternion. - /// The Z component of the quaternion. - /// The W component of the quaternion. - Quaternion( float x, float y, float z, float w ); - - /// - /// Initializes a new instance of the structure. - /// - /// A containing the first three values of the quaternion. - /// The W component of the quaternion. - Quaternion( Vector3 value, float w ); - - /// - /// Gets the identity (0, 0, 0, 1). - /// - static property Quaternion Identity { Quaternion get(); } - - /// - /// Gets a value indicating whether this instance is an identity . - /// - [System::ComponentModel::Browsable(false)] - property bool IsIdentity { bool get(); } - - /// - /// Gets the axis components of the quaternion. - /// - property Vector3 Axis { Vector3 get(); } - - /// - /// Gets the angle of the quaternion. - /// - property float Angle { float get(); } - - /// - /// Calculates the length of the quaternion. - /// - /// The length of the quaternion. - float Length(); - - /// - /// Calculates the squared length of the quaternion. - /// - /// The squared length of the quaternion. - float LengthSquared(); - - /// - /// Converts the quaternion into a unit quaternion. - /// - void Normalize(); - - /// - /// Conjugates the quaternion. - /// - void Conjugate(); - - /// - /// Conjugates and renormalizes the quaternion. - /// - void Invert(); - - /// - /// Adds two quaternions. - /// - /// The first quaternion to add. - /// The second quaternion to add. - /// The sum of the two quaternions. - static Quaternion Add( Quaternion left, Quaternion right ); - - /// - /// Adds two quaternions. - /// - /// The first quaternion to add. - /// The second quaternion to add. - /// When the method completes, contains the sum of the two quaternions. - static void Add( Quaternion% left, Quaternion% right, [Out] Quaternion% result ); - - /// - /// Returns a containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle. - /// - /// A containing the 4D Cartesian coordinates of vertex 1 of the triangle. - /// A containing the 4D Cartesian coordinates of vertex 2 of the triangle. - /// A containing the 4D Cartesian coordinates of vertex 3 of the triangle. - /// Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in ). - /// Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in ). - /// A new containing the 4D Cartesian coordinates of the specified point. - static Quaternion Barycentric( Quaternion source1, Quaternion source2, Quaternion source3, float weight1, float weight2 ); - - /// - /// Returns a containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle. - /// - /// A containing the 4D Cartesian coordinates of vertex 1 of the triangle. - /// A containing the 4D Cartesian coordinates of vertex 2 of the triangle. - /// A containing the 4D Cartesian coordinates of vertex 3 of the triangle. - /// Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in ). - /// Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in ). - /// When the method completes, contains a new containing the 4D Cartesian coordinates of the specified point. - static void Barycentric( Quaternion% source1, Quaternion% source2, Quaternion% source3, float weight1, float weight2, [Out] Quaternion% result ); - - /// - /// Conjugates a quaternion. - /// - /// The quaternion to conjugate. - /// The conjugated quaternion. - static Quaternion Conjugate( Quaternion quaternion ); - - /// - /// Conjugates a quaternion. - /// - /// The quaternion to conjugate. - /// When the method completes, contains the conjugated quaternion. - static void Conjugate( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Divides a quaternion by another. - /// - /// The first quaternion to divide. - /// The second quaternion to divide. - /// The divided quaternion. - static Quaternion Divide( Quaternion left, Quaternion right ); - - /// - /// Divides a quaternion by another. - /// - /// The first quaternion to divide. - /// The second quaternion to divide. - /// The divided quaternion. - static void Divide( Quaternion% left, Quaternion% right, [Out] Quaternion% result ); - - /// - /// Calculates the dot product of two quaternions. - /// - /// First source quaternion. - /// Second source quaternion. - /// The dot product of the two quaternions. - static float Dot( Quaternion left, Quaternion right ); - - /// - /// Exponentiates a quaternion. - /// - /// The quaternion to exponentiate. - /// The exponentiated quaternion. - static Quaternion Exponential( Quaternion quaternion ); - - /// - /// Exponentiates a quaternion. - /// - /// The quaternion to exponentiate. - /// When the method completes, contains the exponentiated quaternion. - static void Exponential( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Conjugates and renormalizes the quaternion. - /// - /// The quaternion to conjugate and renormalize. - /// The conjugated and renormalized quaternion. - static Quaternion Invert( Quaternion quaternion ); - - /// - /// Conjugates and renormalizes the quaternion. - /// - /// The quaternion to conjugate and renormalize. - /// When the method completes, contains the conjugated and renormalized quaternion. - static void Invert( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Performs a linear interpolation between two quaternion. - /// - /// Start quaternion. - /// End quaternion. - /// Value between 0 and 1 indicating the weight of . - /// The linear interpolation of the two quaternions. - /// - /// This method performs the linear interpolation based on the following formula. - /// start + (end - start) * amount - /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. - /// - static Quaternion Lerp( Quaternion start, Quaternion end, float amount ); - - /// - /// Performs a linear interpolation between two quaternions. - /// - /// Start quaternion. - /// End quaternion. - /// Value between 0 and 1 indicating the weight of . - /// When the method completes, contains the linear interpolation of the two quaternions. - /// - /// This method performs the linear interpolation based on the following formula. - /// start + (end - start) * amount - /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. - /// - static void Lerp( Quaternion% start, Quaternion% end, float amount, [Out] Quaternion% result ); - - /// - /// Calculates the natural logarithm of the specified quaternion. - /// - /// The quaternion whose logarithm will be calculated. - /// The natural logarithm of the quaternion. - static Quaternion Logarithm( Quaternion quaternion ); - - /// - /// Calculates the natural logarithm of the specified quaternion. - /// - /// The quaternion whose logarithm will be calculated. - /// When the method completes, contains the natural logarithm of the quaternion. - static void Logarithm( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Modulates a quaternion by another. - /// - /// The first quaternion to modulate. - /// The second quaternion to modulate. - /// The modulated quaternion. - static Quaternion Multiply( Quaternion left, Quaternion right ); - - /// - /// Modulates a quaternion by another. - /// - /// The first quaternion to modulate. - /// The second quaternion to modulate. - /// When the moethod completes, contains the modulated quaternion. - static void Multiply( Quaternion% left, Quaternion% right, [Out] Quaternion% result ); - - /// - /// Scales a quaternion by the given value. - /// - /// The quaternion to scale. - /// The amount by which to scale the quaternion. - /// The scaled quaternion. - static Quaternion Multiply( Quaternion quaternion, float scale ); - - /// - /// Scales a quaternion by the given value. - /// - /// The quaternion to scale. - /// The amount by which to scale the quaternion. - /// When the method completes, contains the scaled quaternion. - static void Multiply( Quaternion% quaternion, float scale, [Out] Quaternion% result ); - - /// - /// Reverses the direction of a given quaternion. - /// - /// The quaternion to negate. - /// A quaternion facing in the opposite direction. - static Quaternion Negate( Quaternion quaternion ); - - /// - /// Reverses the direction of a given quaternion. - /// - /// The quaternion to negate. - /// When the method completes, contains a quaternion facing in the opposite direction. - static void Negate( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Converts the quaternion into a unit quaternion. - /// - /// The quaternion to normalize. - /// The normalized quaternion. - static Quaternion Normalize( Quaternion quaternion ); - - /// - /// Converts the quaternion into a unit quaternion. - /// - /// The quaternion to normalize. - /// When the method completes, contains the normalized quaternion. - static void Normalize( Quaternion% quaternion, [Out] Quaternion% result ); - - /// - /// Creates a quaternion given a rotation and an axis. - /// - /// The axis of rotation. - /// The angle of rotation. - /// The newly created quaternion. - static Quaternion RotationAxis( Vector3 axis, float angle ); - - /// - /// Creates a quaternion given a rotation and an axis. - /// - /// The axis of rotation. - /// The angle of rotation. - /// When the method completes, contains the newly created quaternion. - static void RotationAxis( Vector3% axis, float angle, [Out] Quaternion% result ); - - /// - /// Creates a quaternion given a rotation matrix. - /// - /// The rotation matrix. - /// The newly created quaternion. - static Quaternion RotationMatrix( Matrix matrix ); - - /// - /// Creates a quaternion given a rotation matrix. - /// - /// The rotation matrix. - /// When the method completes, contains the newly created quaternion. - static void RotationMatrix( Matrix% matrix, [Out] Quaternion% result ); - - /// - /// Creates a quaternion given a yaw, pitch, and roll value. - /// - /// The yaw of rotation. - /// The pitch of rotation. - /// The roll of rotation. - /// The newly created quaternion. - static Quaternion RotationYawPitchRoll( float yaw, float pitch, float roll ); - - /// - /// Creates a quaternion given a yaw, pitch, and roll value. - /// - /// The yaw of rotation. - /// The pitch of rotation. - /// The roll of rotation. - /// When the method completes, contains the newly created quaternion. - static void RotationYawPitchRoll( float yaw, float pitch, float roll, [Out] Quaternion% result ); - - /// - /// Interpolates between two quaternions, using spherical linear interpolation. - /// - /// Start quaternion. - /// End quaternion. - /// Value between 0 and 1 indicating the weight of . - /// The spherical linear interpolation of the two quaternions. - static Quaternion Slerp( Quaternion start, Quaternion end, float amount ); - - /// - /// Interpolates between two quaternions, using spherical linear interpolation. - /// - /// Start quaternion. - /// End quaternion. - /// Value between 0 and 1 indicating the weight of . - /// When the method completes, contains the spherical linear interpolation of the two quaternions. - static void Slerp( Quaternion% start, Quaternion% end, float amount, [Out] Quaternion% result ); - - /// - /// Interpolates between quaternions, using spherical quadrangle interpolation. - /// - /// First source quaternion. - /// Second source quaternion. - /// Thrid source quaternion. - /// Fourth source quaternion. - /// Value between 0 and 1 indicating the weight of interpolation. - /// The spherical quadrangle interpolation of the quaternions. - static Quaternion Squad( Quaternion source1, Quaternion source2, Quaternion source3, Quaternion source4, float amount ); - - /// - /// Interpolates between quaternions, using spherical quadrangle interpolation. - /// - /// First source quaternion. - /// Second source quaternion. - /// Thrid source quaternion. - /// Fourth source quaternion. - /// Value between 0 and 1 indicating the weight of interpolation. - /// When the method completes, contains the spherical quadrangle interpolation of the quaternions. - static void Squad( Quaternion% source1, Quaternion% source2, Quaternion% source3, Quaternion% source4, float amount, [Out] Quaternion% result ); - - /// - /// Sets up control points for spherical quadrangle interpolation. - /// - /// First source quaternion. - /// Second source quaternion. - /// Third source quaternion. - /// Fourth source quaternion. - /// An array of three quaternions that represent control points for spherical quadrangle interpolation. - static array^ SquadSetup( Quaternion source1, Quaternion source2, Quaternion source3, Quaternion source4 ); - - /// - /// Subtracts two quaternions. - /// - /// The first quaternion to subtract. - /// The second quaternion to subtract. - /// The difference of the two quaternions. - static Quaternion Subtract( Quaternion left, Quaternion right ); - - /// - /// Subtracts two quaternions. - /// - /// The first quaternion to subtract. - /// The second quaternion to subtract. - /// When the method completes, contains the difference of the two quaternions. - static void Subtract( Quaternion% left, Quaternion% right, [Out] Quaternion% result ); - - /// - /// Multiplies a quaternion by another. - /// - /// The first quaternion to multiply. - /// The second quaternion to multiply. - /// The multiplied quaternion. - static Quaternion operator * ( Quaternion left, Quaternion right ); - - /// - /// Scales a quaternion by the given value. - /// - /// The quaternion to scale. - /// The amount by which to scale the quaternion. - /// The scaled quaternion. - static Quaternion operator * ( Quaternion quaternion, float scale ); - - /// - /// Scales a quaternion by the given value. - /// - /// The quaternion to scale. - /// The amount by which to scale the quaternion. - /// The scaled quaternion. - static Quaternion operator * ( float scale, Quaternion quaternion ); - - /// - /// Divides a quaternion by another. - /// - /// The first quaternion to divide. - /// The second quaternion to divide. - /// The divided quaternion. - static Quaternion operator / ( Quaternion left, float right ); - - /// - /// Adds two quaternions. - /// - /// The first quaternion to add. - /// The second quaternion to add. - /// The sum of the two quaternions. - static Quaternion operator + ( Quaternion left, Quaternion right ); - - /// - /// Subtracts two quaternions. - /// - /// The first quaternion to subtract. - /// The second quaternion to subtract. - /// The difference of the two quaternions. - static Quaternion operator - ( Quaternion left, Quaternion right ); - - /// - /// Reverses the direction of a given quaternion. - /// - /// The quaternion to negate. - /// A quaternion facing in the opposite direction. - static Quaternion operator - ( Quaternion quaternion ); - - /// - /// Tests for equality between two objects. - /// - /// The first value to compare. - /// The second value to compare. - /// true if has the same value as ; otherwise, false. - static bool operator == ( Quaternion left, Quaternion right ); - - /// - /// Tests for inequality between two objects. - /// - /// The first value to compare. - /// The second value to compare. - /// true if has a different value than ; otherwise, false. - static bool operator != ( Quaternion left, Quaternion right ); - - /// - /// Converts the value of the object to its equivalent string representation. - /// - /// The string representation of the value of this instance. - virtual System::String^ ToString() override; - - /// - /// Returns the hash code for this instance. - /// - /// A 32-bit signed integer hash code. - virtual int GetHashCode() override; - - /// - /// Returns a value that indicates whether the current instance is equal to a specified object. - /// - /// Object to make the comparison with. - /// true if the current instance is equal to the specified object; false otherwise. - virtual bool Equals( System::Object^ obj ) override; - - /// - /// Returns a value that indicates whether the current instance is equal to the specified object. - /// - /// Object to make the comparison with. - /// true if the current instance is equal to the specified object; false otherwise. - virtual bool Equals( Quaternion other ); - - /// - /// Determines whether the specified object instances are considered equal. - /// - /// - /// - /// true if is the same instance as or - /// if both are null references or if value1.Equals(value2) returns true; otherwise, false. - static bool Equals( Quaternion% value1, Quaternion% value2 ); - }; -}