first commit of some basics
This commit is contained in:
48
TSE_Math/src/Rect.hpp
Normal file
48
TSE_Math/src/Rect.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include "Vector2.hpp"
|
||||
#include "Vector4.hpp"
|
||||
#include "Types.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace TSE
|
||||
{
|
||||
class Rect
|
||||
{
|
||||
public:
|
||||
Vector2 p1, p2;
|
||||
|
||||
/// @brief default constructer wicht all points starting at (0,0)
|
||||
Rect();
|
||||
/// @brief constructor with floats for custom values
|
||||
/// @param x1 x component of min
|
||||
/// @param y1 y component of min
|
||||
/// @param x2 x component of max
|
||||
/// @param y2 y component of max
|
||||
Rect(float x1, float y1, float x2, float y2);
|
||||
/// @brief constructer with Vector2 for custom values
|
||||
/// @param _p1 min
|
||||
/// @param _p2 max
|
||||
Rect(const Vector2& _p1, const Vector2& _p2);
|
||||
/// @brief constructor wich Vector4 for custom Values
|
||||
/// @param v min -> (x,y) max -> (z,w)
|
||||
Rect(const Vector4& v);
|
||||
/// @brief copy constructor
|
||||
/// @param r the rect to me copied
|
||||
Rect(const Rect& r);
|
||||
|
||||
/// @brief gives you the current width of the rect
|
||||
/// @return the width in local rect space
|
||||
float width() const;
|
||||
/// @brief gives you the current height of the rect
|
||||
/// @return the height in local rect space
|
||||
float height() const;
|
||||
/// @brief gives you the area of the rect based on the height() and width() functions
|
||||
/// @return the area in local rect space
|
||||
float area() const;
|
||||
|
||||
bool operator==(const Rect& other) const;
|
||||
bool operator!=(const Rect& other) const;
|
||||
|
||||
};
|
||||
} // namespace TSE
|
||||
Reference in New Issue
Block a user