Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
vec2.h
1 #pragma once
2 
11 #ifndef VEC2_H_DEFINED
12 #define VEC2_H_DEFINED
13 
14 #include <iostream>
15 #include "core.h"
16 
17 namespace rune{
18 
19 class RUNE_ENGINE Vec2
20 {
21 public:
23  double x;
25  double y;
27  Vec2(double newX = 0, double newY = 0);
29  Vec2 operator- (const Vec2& right);
31  Vec2 operator-();
33  Vec2 operator+ (const Vec2& right);
35  Vec2 operator* (const Vec2& right);
37  Vec2 operator/ (const Vec2& right);
39  Vec2 operator/ (double scalar);
41  Vec2& operator-=(const Vec2& right);
43  Vec2& operator+=(const Vec2& right);
45  Vec2& operator*=(const Vec2& right);
47  Vec2& operator*=(const double right);
49  Vec2 operator* (double scalar);
51  bool operator==(const Vec2& right);
53  bool operator!=(const Vec2& right);
54 
55 };
57 RUNE_ENGINE Vec2 operator/ (double scalar, Vec2 vec);
59 RUNE_ENGINE double dotProduct(rune::Vec2 const& vector1, rune::Vec2 const& vector2);
61 RUNE_ENGINE rune::Vec2 findNormal(rune::Vec2 const& axis);
63 RUNE_ENGINE rune::Vec2 normalize(rune::Vec2 const& vec);
65 RUNE_ENGINE double crossProduct(rune::Vec2 const& vec1, rune::Vec2 const& vec2);
67 RUNE_ENGINE rune::Vec2 operator*(double scalar, rune::Vec2 const& vec);
69 RUNE_ENGINE std::ostream& operator<<(std::ostream& os, const rune::Vec2& vector);
70 
71 }
72 
73 #endif
rune::Vec2::x
double x
X coordinate of the vector.
Definition: vec2.h:23
rune::Vec2::y
double y
Y coordinate of the vector.
Definition: vec2.h:25
rune::operator<<
RUNE_ENGINE std::ostream & operator<<(std::ostream &os, const rune::Vec2 &vector)
Stream operator overloading so that vectors can be printed to the console.
rune::findNormal
RUNE_ENGINE rune::Vec2 findNormal(rune::Vec2 const &axis)
Find a vector that is left handed normal to vector used to describe a surface.
rune::crossProduct
RUNE_ENGINE double crossProduct(rune::Vec2 const &vec1, rune::Vec2 const &vec2)
Cross product calculation of two vectors.
rune::Vec2
1 x 2 vector to be used for math.
Definition: vec2.h:20
rune::normalize
RUNE_ENGINE rune::Vec2 normalize(rune::Vec2 const &vec)
Divides each component of a vector by the vector magnitude to make the vector magnitude equal to 1.
rune::dotProduct
RUNE_ENGINE double dotProduct(rune::Vec2 const &vector1, rune::Vec2 const &vector2)
Dot product calculation of two vectors.
rune::operator/
RUNE_ENGINE Vec2 operator/(double scalar, Vec2 vec)
Overload of / operator for a scalar.
rune
The main namespace to be used for interfacing with the engine.
Definition: animator.h:21
rune::operator*
RUNE_ENGINE rune::Vec2 operator*(rune::Vec2 const &vec, rune::Mat2 &mat)
Overload of multiplication operator for a rune::Mat2.