#ifndef VECTOR_H #define VECTOR_H #pragma once struct Quaternion; extern "C" { typedef struct Vec3 { float x; float y; float z; } Vec3; void CopyVec3(const Vec3& v1, Vec3& v2); } struct Vector3 : Vec3 { public: Vector3(); Vector3(float _x, float _y, float _z); Vector3(Vec3 v); ~Vector3(); const static Vector3 zero; const static Vector3 right; const static Vector3 left; const static Vector3 up; const static Vector3 down; const static Vector3 forward; const static Vector3 back; static float Magnitude(const Vector3& a); float magnitude() const; static float SqrMagnitude(const Vector3& a); float sqrMagnitude() const; static Vector3 Normalize(Vector3 v); Vector3 normalized() const; Vector3 operator -(); Vector3 operator -(const Vector3& p2) const; Vector3 operator +(const Vector3& t1) const; static Vector3 Scale(const Vector3& p1, const Vector3& p2); Vector3 operator *(float f) const; Vector3 operator /(const float& d); static float Dot(const Vector3& v1, const Vector3& v2); bool operator ==(const Vector3& v); static float Distance(const Vector3& p1, const Vector3& p2); static Vector3 Cross(const Vector3& v1, const Vector3& v2); // Projects a vector onto another vector. static Vector3 Project(Vector3 vector, Vector3 onNormal); // Projects a vector onto a plane defined by a normal orthogonal to the plane. static Vector3 ProjectOnPlane(Vector3 vector, Vector3 planeNormal); static float Angle(Vector3 from, Vector3 to); static float SignedAngle(Vector3 from, Vector3 to, Vector3 axis); }; void Vec3_Constructor(Vec3* v, float _x, float _y, float _z); #endif