2013-06-02 14:32:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Vector2.h *
|
|
|
|
* *
|
2013-08-13 20:04:25 +02:00
|
|
|
* XFX Vector2 definition file *
|
2013-06-02 14:32:43 +02:00
|
|
|
* Copyright (c) XFX Team. All Rights Reserved *
|
|
|
|
*****************************************************************************/
|
2013-05-05 18:18:41 +02:00
|
|
|
#ifndef _XFX_VECTOR2_
|
|
|
|
#define _XFX_VECTOR2_
|
|
|
|
|
|
|
|
#include <System/Interfaces.h>
|
|
|
|
|
|
|
|
using namespace System;
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
{
|
|
|
|
struct Matrix;
|
|
|
|
struct Quaternion;
|
|
|
|
|
|
|
|
// Defines a vector with two components.
|
|
|
|
struct Vector2 : IEquatable<Vector2>, Object
|
|
|
|
{
|
|
|
|
static const Vector2 One;
|
|
|
|
float X, Y;
|
|
|
|
static const Vector2 Zero;
|
|
|
|
|
|
|
|
Vector2(const float x, const float y);
|
|
|
|
Vector2(const float value);
|
|
|
|
Vector2(const Vector2 &obj);
|
|
|
|
Vector2();
|
|
|
|
|
|
|
|
static Vector2 Add(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Add(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Baricentric(const Vector2 value1, const Vector2 value2, const Vector2 value3, const float amount1, const float amount2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Baricentric(const Vector2& value1, const Vector2& value2, const Vector2& value3, const float amount1, const float amount2, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 CatmullRom(const Vector2 value1, const Vector2 value2, const Vector2 value3, const Vector2 value4, const float amount);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void CatmullRom(const Vector2& value1, const Vector2& value2, const Vector2& value3, const Vector2& value4, const float amount, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Clamp(const Vector2 value, const Vector2 min, const Vector2 max);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Clamp(const Vector2& value, const Vector2& min, const Vector2& max, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static float Distance(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Distance(const Vector2& value1, const Vector2& value2, out float& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static float DistanceSquared(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void DistanceSquared(const Vector2& value1, const Vector2& value2, out float& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Divide(const Vector2 value1, const float divider);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Divide(const Vector2& value1, const float divider, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Divide(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Divide(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static float Dot(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Dot(const Vector2& value1, const Vector2& value2, out float& result);
|
2013-05-31 15:58:00 +02:00
|
|
|
bool Equals(Object const * const obj) const;
|
2013-05-05 18:18:41 +02:00
|
|
|
bool Equals(const Vector2 other) const;
|
2013-08-13 20:04:25 +02:00
|
|
|
int GetHashCode() const;
|
|
|
|
static const Type& GetType();
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Hermite(const Vector2 value1, const Vector2 tangent1, const Vector2 value2, const Vector2 tangent2, const float amount);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Hermite(const Vector2& value1, const Vector2& tangent1, const Vector2& value2, const Vector2& tangent2, const float amount, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
float Length() const;
|
|
|
|
float LengthSquared() const;
|
|
|
|
static Vector2 Lerp(const Vector2 value1, const Vector2 value2, const float amount);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Lerp(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Max(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Max(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Min(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Min(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Multiply(const Vector2 value, const float scaleFactor);
|
|
|
|
void Multiply(const Vector2& value1, const float scaleFactor, out Vector2& result);
|
|
|
|
static Vector2 Multiply(const Vector2 value1, const Vector2 value2);
|
|
|
|
void Multiply(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
|
|
|
static Vector2 Negate(const Vector2 value);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Negate(const Vector2& value, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
void Normalize();
|
|
|
|
static Vector2 Normalize(const Vector2 value);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Normalize(const Vector2& value, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Reflect(const Vector2 vector, const Vector2 normal);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Reflect(const Vector2& vector, const Vector2& normal, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 SmoothStep(const Vector2 value1, const Vector2 value2, const float amount);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void SmoothStep(const Vector2& value1, const Vector2& value2, const float amount, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Subtract(const Vector2 value1, const Vector2 value2);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Subtract(const Vector2& value1, const Vector2& value2, out Vector2& result);
|
2013-07-11 20:00:07 +02:00
|
|
|
const String ToString() const;
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Transform(const Vector2 position, const Matrix matrix);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Transform(const Vector2& position, const Matrix& matrix, out Vector2& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 Transform(const Vector2 position, const Quaternion rotation);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void Transform(const Vector2& position, const Quaternion& rotation, out Vector2& result);
|
|
|
|
static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length);
|
|
|
|
static void Transform(const Vector2 sourceArray[], const int sourceIndex, const Quaternion& rotation, Vector2 destinationArray[], const int destinationIndex, const int length);
|
2013-05-05 18:18:41 +02:00
|
|
|
static Vector2 TransformNormal(const Vector2 normal, const Matrix matrix);
|
2013-08-13 20:04:25 +02:00
|
|
|
static void TransformNormal(const Vector2& normal, const Matrix& matrix, out Vector2& result);
|
|
|
|
static void TransformNormal(const Vector2 sourceArray[], const int sourceIndex, const Matrix& matrix, Vector2 destinationArray[], const int destinationIndex, const int length);
|
2013-05-05 18:18:41 +02:00
|
|
|
|
|
|
|
Vector2 operator -(const Vector2& other) const;
|
|
|
|
Vector2 operator -() const;
|
|
|
|
Vector2 operator +(const Vector2& other) const;
|
|
|
|
Vector2 operator /(const float divider) const;
|
|
|
|
Vector2 operator /(const Vector2& other) const;
|
|
|
|
bool operator==(const Vector2& other) const;
|
|
|
|
bool operator!=(const Vector2& other) const;
|
|
|
|
Vector2 operator *(const float scaleFactor) const;
|
|
|
|
Vector2 operator *(const Vector2& other) const;
|
|
|
|
} ALIGNED16;
|
|
|
|
|
|
|
|
Vector2 operator *(const float scaleFactor, const Vector2& vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_XFX_VECTOR2_
|