Added Vector2::one and Vector3::one

This commit is contained in:
Pascal Serrarens 2022-04-15 16:03:18 +02:00
parent c1a926582e
commit d3e2ded5d7
4 changed files with 208 additions and 198 deletions

View File

@ -6,12 +6,12 @@
#define VECTOR2_H
extern "C" {
/// <summary>
/// 2-dimensional Vector representation
/// </summary>
/// This is a C-style implementation
/// This uses the right-handed coordinate system.
typedef struct Vec2 {
/// <summary>
/// 2-dimensional Vector representation
/// </summary>
/// This is a C-style implementation
/// This uses the right-handed coordinate system.
typedef struct Vec2 {
/// <summary>
/// The right axis of the vector
/// </summary>
@ -21,7 +21,7 @@ typedef struct Vec2 {
/// </summary>
float y;
} Vec2;
} Vec2;
}
/// <summary>
@ -29,7 +29,7 @@ typedef struct Vec2 {
/// </summary>
/// This uses the right-handed coordinate system.
struct Vector2 : Vec2 {
public:
public:
/// <summary>
/// Create a new 2-dimensinal zero vector
/// </summary>
@ -53,6 +53,10 @@ struct Vector2 : Vec2 {
/// </summary>
const static Vector2 zero;
/// <summary>
/// A vector with values (1, 1)
/// </summary>
const static Vector2 one;
/// <summary>
/// A vector with values (1, 0)
/// </summary>
const static Vector2 right;

View File

@ -57,6 +57,10 @@ public:
/// </summary>
const static Vector3 zero;
/// <summary>
/// A vector with one for all axis
/// </summary>
const static Vector3 one;
/// <summary>
/// A vector with values (1, 0, 0)
/// </summary>
const static Vector3 right;

View File

@ -25,6 +25,7 @@ Vector2::Vector2(Vec2 v) {
Vector2::~Vector2() {}
const Vector2 Vector2::zero = Vector2(0, 0);
const Vector2 Vector2::one = Vector2(1, 1);
const Vector2 Vector2::right = Vector2(1, 0);
const Vector2 Vector2::left = Vector2(-1, 0);
const Vector2 Vector2::up = Vector2(0, 1);

View File

@ -31,6 +31,7 @@ Vector3::~Vector3() {
}
const Vector3 Vector3::zero = Vector3(0, 0, 0);
const Vector3 Vector3::one = Vector3(1, 1, 1);
const Vector3 Vector3::right = Vector3(1, 0, 0);
const Vector3 Vector3::left = Vector3(-1, 0, 0);
const Vector3 Vector3::up = Vector3(0, 1, 0);