2D quad structure. More...
#include <quad.h>
Public Member Functions | |
Quadx () | |
Constructs a quad. | |
Quadx (const Quadx< Type > &quad) | |
Constructs a quad. | |
Quadx (const Rectx< Type > &rect) | |
Constructs a quad. | |
Quadx (const Vec2< Type > &new_p, const Vec2< Type > &new_q, const Vec2< Type > &new_r, const Vec2< Type > &new_s) | |
Constructs a quad. | |
Quadx< Type > & | apply_alignment (Origin origin, Type x, Type y) |
Applies an origin and offset pair to this rectangle. | |
Vec2< Type > | center () const |
Returns the center point of the quad. | |
Rect | get_bounds () const |
Returns the bounding box of the quad as a Rect. | |
Type | get_height () const |
Returns the height of the quad. | |
Sizex< Type > | get_size () const |
Returns the size of the rectangle. | |
Type | get_width () const |
Returns the width of the quad. | |
bool | is_inside (const Vec2< Type > &point) const |
Check if a point is inside or outside the quad. | |
bool | operator!= (const Quadx< Type > &quad) const |
Quad != Quad operator. | |
Quadx< Type > | operator+ (const Quadx< Type > &quad) const |
Quad + Quad operator. | |
Quadx< Type > | operator+ (const Vec2< Type > &point) const |
Quad + Point operator. | |
Quadx< Type > & | operator+= (const Quadx< Type > &quad) |
Quad += Quad operator. | |
Quadx< Type > & | operator+= (const Vec2< Type > &point) |
Quad += Point operator. | |
Quadx< Type > | operator- (const Quadx< Type > &quad) const |
Quad - Quad operator. | |
Quadx< Type > | operator- (const Vec2< Type > &point) const |
Quad - Point operator. | |
Quadx< Type > & | operator-= (const Quadx< Type > &quad) |
Quad -= Quad operator. | |
Quadx< Type > & | operator-= (const Vec2< Type > &point) |
Quad -= Point operator. | |
bool | operator== (const Quadx< Type > &quad) const |
Quad == Quad operator. | |
Quadx< Type > & | rotate (const Vec2< Type > &hotspot, const Angle &angle) |
Rotates the Quad. | |
Quadx< Type > & | scale (const Vec2< Type > &hotspot, float sx, float sy) |
Scale the Quad. | |
Quadx< Type > & | scale (float sx, float sy) |
Scale the Quad. | |
Public Attributes | |
Vec2< Type > | p |
First Point. | |
Vec2< Type > | q |
Second Point. | |
Vec2< Type > | r |
Third Point. | |
Vec2< Type > | s |
Fourth Point. | |
2D quad structure.
These quads templates are defined for: int (Quad), float (Quadf), double (Quadd)
|
inline |
Constructs a quad.
Referenced by clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator-(), and clan::Quadx< Type >::operator-().
|
inline |
Constructs a quad.
new_p | = coord for first point of quad. |
new_q | = coord for second point of quad. |
new_r | = coord for third point of quad. |
new_s | = coord for forth point of quad. |
|
inline |
Constructs a quad.
rect | Rectangle used to initialize the quad. |
The corners of the rect are mapped to the quad member variables as follows:
|
inline |
Constructs a quad.
quad | = Quad used to initialize this quad. |
Quadx< Type > & clan::Quadx< Type >::apply_alignment | ( | Origin | origin, |
Type | x, | ||
Type | y | ||
) |
Applies an origin and offset pair to this rectangle.
origin | The new origin to adjust to from default upper-left position |
x,y | Offsets applied negatively to each corner of the rectangle |
Vec2< Type > clan::Quadx< Type >::center | ( | ) | const |
Returns the center point of the quad.
Rect clan::Quadx< Type >::get_bounds | ( | ) | const |
Returns the bounding box of the quad as a Rect.
Type clan::Quadx< Type >::get_height | ( | ) | const |
Returns the height of the quad.
Referenced by clan::Quadx< Type >::get_size().
|
inline |
Returns the size of the rectangle.
References clan::Quadx< Type >::get_height(), and clan::Quadx< Type >::get_width().
Type clan::Quadx< Type >::get_width | ( | ) | const |
Returns the width of the quad.
Referenced by clan::Quadx< Type >::get_size().
bool clan::Quadx< Type >::is_inside | ( | const Vec2< Type > & | point | ) | const |
Check if a point is inside or outside the quad.
|
inline |
References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.
|
inline |
|
inline |
|
inline |
References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.
|
inline |
|
inline |
|
inline |
|
inline |
References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.
|
inline |
|
inline |
References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.
Quadx< Type > & clan::Quadx< Type >::rotate | ( | const Vec2< Type > & | hotspot, |
const Angle & | angle | ||
) |
Quadx< Type > & clan::Quadx< Type >::scale | ( | const Vec2< Type > & | hotspot, |
float | sx, | ||
float | sy | ||
) |
Quadx< Type > & clan::Quadx< Type >::scale | ( | float | sx, |
float | sy | ||
) |
Scale the Quad.
sx | = Scale value in x-axis |
sy | = Scale value in y-axis |
Vec2<Type> clan::Quadx< Type >::p |
First Point.
Referenced by clan::Quadx< Type >::operator!=(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-=(), clan::Quadx< Type >::operator-=(), and clan::Quadx< Type >::operator==().
Vec2<Type> clan::Quadx< Type >::q |
Second Point.
Referenced by clan::Quadx< Type >::operator!=(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-=(), clan::Quadx< Type >::operator-=(), and clan::Quadx< Type >::operator==().
Vec2<Type> clan::Quadx< Type >::r |
Third Point.
Referenced by clan::Quadx< Type >::operator!=(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-=(), clan::Quadx< Type >::operator-=(), and clan::Quadx< Type >::operator==().
Vec2<Type> clan::Quadx< Type >::s |
Fourth Point.
Referenced by clan::Quadx< Type >::operator!=(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator+=(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-(), clan::Quadx< Type >::operator-=(), clan::Quadx< Type >::operator-=(), and clan::Quadx< Type >::operator==().