mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 12:09:20 +01:00
Remove Point2f, replace with Vector2f
This commit is contained in:
@@ -8,26 +8,25 @@ struct Vector2f final
|
||||
// -------------------------
|
||||
Vector2f( );
|
||||
explicit Vector2f( float x, float y );
|
||||
explicit Vector2f( const Point2f& fromPoint, const Point2f& tillPoint );
|
||||
explicit Vector2f( const Point2f& point );
|
||||
explicit Vector2f( const Vector2f& fromPoint, const Vector2f& tillPoint );
|
||||
// explicit Vector2f( const Vector2f& point );
|
||||
|
||||
// -------------------------
|
||||
// Member operators
|
||||
// -------------------------
|
||||
Vector2f operator-( ) const;
|
||||
Vector2f operator+( ) const;
|
||||
Vector2f& operator*=( float rhs);
|
||||
Vector2f& operator/=( float rhs);
|
||||
Vector2f& operator+=( const Vector2f& rhs);
|
||||
Vector2f& operator-=( const Vector2f& rhs);
|
||||
explicit operator Point2f();
|
||||
|
||||
|
||||
Vector2f& operator*=( float rhs);
|
||||
Vector2f& operator/=( float rhs);
|
||||
|
||||
|
||||
// -------------------------
|
||||
// Methods
|
||||
// -------------------------
|
||||
// Convert to Point2f
|
||||
Point2f ToPoint2f( ) const;
|
||||
|
||||
// Are two vectors equal within a threshold?
|
||||
// u.Equals(v)
|
||||
bool Equals( const Vector2f& other, float epsilon = 0.001f ) const;
|
||||
@@ -75,6 +74,7 @@ struct Vector2f final
|
||||
|
||||
// Sets the values of x and y
|
||||
void Set( float newX, float newY );
|
||||
Vector2f operator*(const Vector2f& vector2_f) const;
|
||||
|
||||
// -------------------------
|
||||
// Datamembers
|
||||
@@ -88,6 +88,8 @@ struct Vector2f final
|
||||
Vector2f operator*( float lhs, Vector2f rhs );
|
||||
Vector2f operator*( Vector2f lhs, float rhs );
|
||||
Vector2f operator/( Vector2f lhs, float rhs );
|
||||
Vector2f operator/(float lhs, const Vector2f& rhs);
|
||||
|
||||
|
||||
Vector2f operator+( Vector2f lhs, const Vector2f& rhs );
|
||||
Vector2f operator-( Vector2f lhs, const Vector2f& rhs );
|
||||
@@ -95,15 +97,4 @@ Vector2f operator-( Vector2f lhs, const Vector2f& rhs );
|
||||
bool operator==( const Vector2f& lhs, const Vector2f& rhs );
|
||||
bool operator!=( const Vector2f& lhs, const Vector2f& rhs );
|
||||
|
||||
std::ostream& operator<< ( std::ostream& lhs, const Vector2f& rhs );
|
||||
|
||||
// Translating a point by a vector
|
||||
Point2f& operator+=(Point2f& lhs, const Vector2f& rhs);
|
||||
Point2f operator+(Point2f lhs, const Vector2f& rhs);
|
||||
|
||||
Point2f& operator-=(Point2f& lhs, const Vector2f& rhs);
|
||||
Point2f operator-(Point2f lhs, const Vector2f& rhs);
|
||||
|
||||
// The difference vector between 2 points
|
||||
Vector2f operator-( const Point2f& lhs, const Point2f& rhs);
|
||||
|
||||
std::ostream& operator<< ( std::ostream& lhs, const Vector2f& rhs );
|
||||
Reference in New Issue
Block a user