X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=SlimDXc_Jun2010%28VC%2B%2B2008%29%2Fsource%2Fmath%2FVector2.h;fp=SlimDXc_Jun2010%28VC%2B%2B2008%29%2Fsource%2Fmath%2FVector2.h;h=0000000000000000000000000000000000000000;hb=d3453b257c2faf4db202d38666a872929ff220cd;hp=0362dd5431431845e20c40a04a6c47c0af2a0ed3;hpb=1c2eac207d4963c6bc170b3f7fbe0feeffcd17e0;p=dtxmania%2Fdtxmania.git
diff --git a/SlimDXc_Jun2010(VC++2008)/source/math/Vector2.h b/SlimDXc_Jun2010(VC++2008)/source/math/Vector2.h
deleted file mode 100644
index 0362dd54..00000000
--- a/SlimDXc_Jun2010(VC++2008)/source/math/Vector2.h
+++ /dev/null
@@ -1,613 +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/Vector2Converter.h"
-
-#include "Vector4.h"
-
-using System::Runtime::InteropServices::OutAttribute;
-
-namespace SlimDX
-{
- value class Quaternion;
- value class Matrix;
- value class Vector3;
- value class Viewport;
-
- ///
- /// Defines a two component vector.
- ///
- /// D3DXVECTOR2
- [System::Serializable]
- [System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential, Pack = 4 )]
- [System::ComponentModel::TypeConverter( SlimDX::Design::Vector2Converter::typeid )]
- public value class Vector2 : System::IEquatable
- {
- public:
- ///
- /// Gets or sets the X component of the vector.
- ///
- /// The X component of the vector.
- float X;
-
- ///
- /// Gets or sets the Y component of the vector.
- ///
- /// The Y component of the vector.
- float Y;
-
- property float default[int]
- {
- float get( int index );
- void set( int index, float value );
- }
-
- ///
- /// Gets a with all of its components set to zero.
- ///
- /// A that has all of its components set to zero.
- static property Vector2 Zero { Vector2 get() { return Vector2(0, 0); } }
-
- ///
- /// Gets the X unit (1, 0).
- ///
- /// A that has a value of (1, 0).
- static property Vector2 UnitX { Vector2 get() { return Vector2(1, 0); } }
-
- ///
- /// Gets the Y unit (0, 1).
- ///
- /// A that has a value of (0, 1).
- static property Vector2 UnitY { Vector2 get() { return Vector2(0, 1); } }
-
- ///
- /// Gets the size of the type, in bytes.
- ///
- static property int SizeInBytes { int get() { return System::Runtime::InteropServices::Marshal::SizeOf(Vector2::typeid); } }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The value that will be assigned to all components.
- Vector2( float value );
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Initial value for the X component of the vector.
- /// Initial value for the Y component of the vector.
- Vector2( float x, float y );
-
- ///
- /// Calculates the length of the vector.
- ///
- /// The length of the vector.
- float Length();
-
- ///
- /// Calculates the squared length of the vector.
- ///
- /// The squared length of the vector.
- float LengthSquared();
-
- ///
- /// Converts the vector into a unit vector.
- ///
- void Normalize();
-
- ///
- /// Adds two vectors.
- ///
- /// The first vector to add.
- /// The second vector to add.
- /// The sum of the two vectors.
- static Vector2 Add( Vector2 left, Vector2 right );
-
- ///
- /// Adds two vectors.
- ///
- /// The first vector to add.
- /// The second vector to add.
- /// When the method completes, contains the sum of the two vectors.
- static void Add( Vector2% left, Vector2% right, [Out] Vector2% result );
-
- ///
- /// Subtracts two vectors.
- ///
- /// The first vector to subtract.
- /// The second vector to subtract.
- /// The difference of the two vectors.
- static Vector2 Subtract( Vector2 left, Vector2 right );
-
- ///
- /// Subtracts two vectors.
- ///
- /// The first vector to subtract.
- /// The second vector to subtract.
- /// When the method completes, contains the difference of the two vectors.
- static void Subtract( Vector2% left, Vector2% right, [Out] Vector2% result );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// The scaled vector.
- static Vector2 Multiply( Vector2 value, float scale );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// When the method completes, contains the scaled vector.
- static void Multiply( Vector2% vector, float scale, [Out] Vector2% result );
-
- ///
- /// Modulates a vector by another.
- ///
- /// The first vector to modulate.
- /// The second vector to modulate.
- /// The modulated vector.
- static Vector2 Modulate( Vector2 left, Vector2 right );
-
- ///
- /// Modulates a vector by another.
- ///
- /// The first vector to modulate.
- /// The second vector to modulate.
- /// When the moethod completes, contains the modulated vector.
- static void Modulate( Vector2% left, Vector2% right, [Out] Vector2% result );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// The scaled vector.
- static Vector2 Divide( Vector2 value, float scale );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// When the method completes, contains the scaled vector.
- static void Divide( Vector2% vector, float scale, [Out] Vector2% result );
-
- ///
- /// Reverses the direction of a given vector.
- ///
- /// The vector to negate.
- /// A vector facing in the opposite direction.
- static Vector2 Negate( Vector2 value );
-
- ///
- /// Reverses the direction of a given vector.
- ///
- /// The vector to negate.
- /// When the method completes, contains a vector facing in the opposite direction.
- static void Negate( Vector2% value, [Out] Vector2% result );
-
- ///
- /// Returns a containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
- ///
- /// A containing the 2D Cartesian coordinates of vertex 1 of the triangle.
- /// A containing the 2D Cartesian coordinates of vertex 2 of the triangle.
- /// A containing the 2D 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 2D Cartesian coordinates of the specified point.
- static Vector2 Barycentric( Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2 );
-
- ///
- /// Returns a containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
- ///
- /// A containing the 2D Cartesian coordinates of vertex 1 of the triangle.
- /// A containing the 2D Cartesian coordinates of vertex 2 of the triangle.
- /// A containing the 2D 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 the 2D Cartesian coordinates of the specified point.
- static void Barycentric( Vector2% value1, Vector2% value2, Vector2% value3, float amount1, float amount2, [Out] Vector2% result );
-
- ///
- /// Performs a Catmull-Rom interpolation using the specified positions.
- ///
- /// The first position in the interpolation.
- /// The second position in the interpolation.
- /// The third position in the interpolation.
- /// The fourth position in the interpolation.
- /// Weighting factor.
- /// A vector that is the result of the Catmull-Rom interpolation.
- static Vector2 CatmullRom( Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount );
-
- ///
- /// Performs a Catmull-Rom interpolation using the specified positions.
- ///
- /// The first position in the interpolation.
- /// The second position in the interpolation.
- /// The third position in the interpolation.
- /// The fourth position in the interpolation.
- /// Weighting factor.
- /// When the method completes, contains the result of the Catmull-Rom interpolation.
- static void CatmullRom( Vector2% value1, Vector2% value2, Vector2% value3, Vector2% value4, float amount, [Out] Vector2% result );
-
- ///
- /// Restricts a value to be within a specified range.
- ///
- /// The value to clamp.
- /// The minimum value.
- /// The maximum value.
- /// The clamped value.
- static Vector2 Clamp( Vector2 value, Vector2 min, Vector2 max );
-
- ///
- /// Restricts a value to be within a specified range.
- ///
- /// The value to clamp.
- /// The minimum value.
- /// The maximum value.
- /// When the method completes, contains the clamped value.
- static void Clamp( Vector2% value, Vector2% min, Vector2% max, [Out] Vector2% result );
-
- ///
- /// Performs a Hermite spline interpolation.
- ///
- /// First source position vector.
- /// First source tangent vector.
- /// Second source position vector.
- /// Second source tangent vector.
- /// Weighting factor.
- /// The result of the Hermite spline interpolation.
- static Vector2 Hermite( Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount );
-
- ///
- /// Performs a Hermite spline interpolation.
- ///
- /// First source position vector.
- /// First source tangent vector.
- /// Second source position vector.
- /// Second source tangent vector.
- /// Weighting factor.
- /// When the method completes, contains the result of the Hermite spline interpolation.
- static void Hermite( Vector2% value1, Vector2% tangent1, Vector2% value2, Vector2% tangent2, float amount, [Out] Vector2% result );
-
- ///
- /// Performs a linear interpolation between two vectors.
- ///
- /// Start vector.
- /// End vector.
- /// Value between 0 and 1 indicating the weight of .
- /// The linear interpolation of the two vectors.
- ///
- /// 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 Vector2 Lerp( Vector2 start, Vector2 end, float amount );
-
- ///
- /// Performs a linear interpolation between two vectors.
- ///
- /// Start vector.
- /// End vector.
- /// Value between 0 and 1 indicating the weight of .
- /// When the method completes, contains the linear interpolation of the two vectors.
- ///
- /// 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( Vector2% start, Vector2% end, float amount, [Out] Vector2% result );
-
- ///
- /// Performs a cubic interpolation between two vectors.
- ///
- /// Start vector.
- /// End vector.
- /// Value between 0 and 1 indicating the weight of .
- /// The cubic interpolation of the two vectors.
- static Vector2 SmoothStep( Vector2 start, Vector2 end, float amount );
-
- ///
- /// Performs a cubic interpolation between two vectors.
- ///
- /// Start vector.
- /// End vector.
- /// Value between 0 and 1 indicating the weight of .
- /// When the method completes, contains the cubic interpolation of the two vectors.
- static void SmoothStep( Vector2% start, Vector2% end, float amount, [Out] Vector2% result );
-
- ///
- /// Calculates the distance between two vectors.
- ///
- /// The first vector.
- /// The second vector.
- /// The distance between the two vectors.
- static float Distance( Vector2 value1, Vector2 value2 );
-
- ///
- /// Calculates the squared distance between two vectors.
- ///
- /// The first vector.
- /// The second vector.
- /// The squared distance between the two vectors.
- /// Distance squared is the value before taking the square root.
- /// Distance squared can often be used in place of distance if relative comparisons are being made.
- /// For example, consider three points A, B, and C. To determine whether B or C is further from A,
- /// compare the distance between A and B to the distance between A and C. Calculating the two distances
- /// involves two square roots, which are computationally expensive. However, using distance squared
- /// provides the same information and avoids calculating two square roots.
- ///
- static float DistanceSquared( Vector2 value1, Vector2 value2 );
-
- ///
- /// Calculates the dot product of two vectors.
- ///
- /// First source vector.
- /// Second source vector.
- /// The dot product of the two vectors.
- static float Dot( Vector2 left, Vector2 right );
-
- ///
- /// Converts the vector into a unit vector.
- ///
- /// The vector to normalize.
- /// The normalized vector.
- static Vector2 Normalize( Vector2 vector );
-
- ///
- /// Converts the vector into a unit vector.
- ///
- /// The vector to normalize.
- /// When the method completes, contains the normalized vector.
- static void Normalize( Vector2% vector, [Out] Vector2% result );
-
- ///
- /// Transforms a 2D vector by the given .
- ///
- /// The source vector.
- /// The transformation .
- /// The transformed .
- static Vector4 Transform( Vector2 vector, Matrix transformation );
-
- ///
- /// Transforms a 2D vector by the given .
- ///
- /// The source vector.
- /// The transformation .
- /// When the method completes, contains the transformed .
- static void Transform( Vector2% vector, Matrix% transformation, [Out] Vector4% result );
-
- ///
- /// Transforms an array of 2D vectors by the given .
- ///
- /// The source vectors.
- /// The transformation .
- /// The transformed s.
- static array^ Transform( array^ vectors, Matrix% transformation );
-
- ///
- /// Transforms a 2D vector by the given rotation.
- ///
- /// The vector to rotate.
- /// The rotation to apply.
- /// The transformed .
- static Vector4 Transform( Vector2 vector, Quaternion rotation );
-
- ///
- /// Transforms a 2D vector by the given rotation.
- ///
- /// The vector to rotate.
- /// The rotation to apply.
- /// When the method completes, contains the transformed .
- static void Transform( Vector2% vector, Quaternion% rotation, [Out] Vector4% result );
-
- ///
- /// Transforms an array of 2D vectors by the given rotation.
- ///
- /// The vectors to rotate.
- /// The rotation to apply.
- /// The transformed .
- static array^ Transform( array^ vectors, Quaternion% rotation );
-
- ///
- /// Performs a coordinate transformation using the given .
- ///
- /// The coordinate vector to transform.
- /// The transformation .
- /// The transformed coordinates.
- static Vector2 TransformCoordinate( Vector2 coordinate, Matrix transformation );
-
- ///
- /// Performs a coordinate transformation using the given .
- ///
- /// The coordinate vector to transform.
- /// The transformation .
- /// When the method completes, contains the transformed coordinates.
- static void TransformCoordinate( Vector2% coordinate, Matrix% transformation, [Out] Vector2% result );
-
- ///
- /// Performs a coordinate transformation using the given .
- ///
- /// The coordinate vectors to transform.
- /// The transformation .
- /// The transformed coordinates.
- static array^ TransformCoordinate( array^ coordinates, Matrix% transformation );
-
- ///
- /// Performs a normal transformation using the given .
- ///
- /// The normal vector to transform.
- /// The transformation .
- /// The transformed normal.
- static Vector2 TransformNormal( Vector2 normal, Matrix transformation );
-
- ///
- /// Performs a normal transformation using the given .
- ///
- /// The normal vector to transform.
- /// The transformation .
- /// When the method completes, contains the transformed normal.
- static void TransformNormal( Vector2% normal, Matrix% transformation, [Out] Vector2% result );
-
- ///
- /// Performs a normal transformation using the given .
- ///
- /// The normal vectors to transform.
- /// The transformation .
- /// The transformed normals.
- static array^ TransformNormal( array^ normals, Matrix% transformation );
-
- ///
- /// Returns a vector containing the smallest components of the specified vectors.
- ///
- /// The first source vector.
- /// The second source vector.
- /// A vector containing the smallest components of the source vectors.
- static Vector2 Minimize( Vector2 value1, Vector2 value2 );
-
- ///
- /// Returns a vector containing the smallest components of the specified vectors.
- ///
- /// The first source vector.
- /// The second source vector.
- /// When the method completes, contains an new vector composed of the smallest components of the source vectors.
- static void Minimize( Vector2% value1, Vector2% value2, [Out] Vector2% result );
-
- ///
- /// Returns a vector containing the largest components of the specified vectors.
- ///
- /// The first source vector.
- /// The second source vector.
- /// A vector containing the largest components of the source vectors.
- static Vector2 Maximize( Vector2 value1, Vector2 value2 );
-
- ///
- /// Returns a vector containing the smallest components of the specified vectors.
- ///
- /// The first source vector.
- /// The second source vector.
- /// When the method completes, contains an new vector composed of the largest components of the source vectors.
- static void Maximize( Vector2% value1, Vector2% value2, [Out] Vector2% result );
-
- ///
- /// Adds two vectors.
- ///
- /// The first vector to add.
- /// The second vector to add.
- /// The sum of the two vectors.
- static Vector2 operator + ( Vector2 left, Vector2 right );
-
- ///
- /// Subtracts two vectors.
- ///
- /// The first vector to subtract.
- /// The second vector to subtract.
- /// The difference of the two vectors.
- static Vector2 operator - ( Vector2 left, Vector2 right );
-
- ///
- /// Reverses the direction of a given vector.
- ///
- /// The vector to negate.
- /// A vector facing in the opposite direction.
- static Vector2 operator - ( Vector2 value );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// The scaled vector.
- static Vector2 operator * ( Vector2 vector, float scale );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// The scaled vector.
- static Vector2 operator * ( float scale, Vector2 vector );
-
- ///
- /// Scales a vector by the given value.
- ///
- /// The vector to scale.
- /// The amount by which to scale the vector.
- /// The scaled vector.
- static Vector2 operator / ( Vector2 vector, float scale );
-
- ///
- /// 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 == ( Vector2 left, Vector2 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 != ( Vector2 left, Vector2 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( Vector2 other );
-
- ///
- /// Determines whether the specified object instances are considered equal.
- ///
- /// The first value to compare.
- /// The second value to compare.
- /// 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( Vector2% value1, Vector2% value2 );
- };
-}