-
Notifications
You must be signed in to change notification settings - Fork 513
Vector2
Chuck Walbourn edited this page Nov 3, 2015
·
15 revisions
Two component vector class modeled after the XNA Game Studio math library.
#include <SimpleMath.h>
using namespace DirectX::SimpleMath;
Vector2 v; // Creates a vector [0, 0]
Vector2 v(4); // Creates a vector [4, 4]
Vector2 v(1, 2); // Creates a vector [1, 2]
float arr[2] = { 1, 2 };
Vector2 v(arr); // Creates a vector [1, 2]
- x component of vector
- y component of vector
- Comparison operators:
==
and!=
- Assignment operators:
=
,+=
,-=
,*=
,/=
- Unary operators:
+
,-
- InBounds
- Length
- LengthSquared
- Dot
- Cross
- Normalize
- Clamp
- Distance
- DistanceSquared
- Min
- Max
- Lerp
- SmoothStep
- Barycentric
- CatmullRom
- Hermite
- Reflect
- Refract
- Transform
- TransformNormal
- Zero: Zero vector [0, 0]
- One: One vector [1, 1]
- UnitX: Unit X vector [1, 0]
- UnitY: Unit Y vector [0, 1]
Vector2 can freely convert to and from a XMFLOAT2
and XMVECTOR
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Xbox One
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- MinGW 12.2, 13.2
- CMake 3.20