clan::Quadx< Type > Class Template Reference - ClanLib SDK
Description: clan::Quadx< Type > Class Template Reference

Public Member Functions | Public Attributes | List of all members
clan::Quadx< Type > Class Template Reference
clanCore Math

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.

## Detailed Description

template<typename Type>
class clan::Quadx< Type >

2D quad structure.

These quads templates are defined for: int (Quad), float (Quadf), double (Quadd)

## Constructor & Destructor Documentation

## ◆ Quadx() [1/4]

template<typename Type >

clan::Quadx< Type >::Quadx | ( |  | ) |
| inline

Constructs a quad.

Referenced by clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator+(), clan::Quadx< Type >::operator-(), and clan::Quadx< Type >::operator-().

## ◆ Quadx() [2/4]

template<typename Type >

clan::Quadx< Type >::Quadx | ( | const Vec2< Type > & | new_p,
|  | const Vec2< Type > & | new_q,
|  | const Vec2< Type > & | new_r,
|  | const Vec2< Type > & | new_s )
| inline

Constructs a quad.

Parameters

  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.

## ◆ Quadx() [3/4]

template<typename Type >

clan::Quadx< Type >::Quadx | ( | const Rectx< Type > & | rect | ) |
| inline

Constructs a quad.

Parameters

  rect | Rectangle used to initialize the quad.

The corners of the rect are mapped to the quad member variables as follows:

- Top-left: p
- Top-right: q
- Bottom-right: r
- Bottom-left: s

## ◆ Quadx() [4/4]

template<typename Type >

clan::Quadx< Type >::Quadx | ( | const Quadx< Type > & | quad | ) |
| inline

Constructs a quad.

Parameters

  quad | = Quad used to initialize this quad.

## Member Function Documentation

## ◆ apply_alignment()

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::apply_alignment | ( | Origin | origin,
|  | Type | x,
|  | Type | y )

Applies an origin and offset pair to this rectangle.

Parameters

  origin | The new origin to adjust to from default upper-left position
  x,y | Offsets applied negatively to each corner of the rectangle

Returns
  reference to this object

## ◆ center()

template<typename Type >

Vec2< Type > clan::Quadx< Type >::center | ( |  | ) | const

Returns the center point of the quad.

## ◆ get_bounds()

template<typename Type >

Rect clan::Quadx< Type >::get_bounds | ( |  | ) | const

Returns the bounding box of the quad as a Rect.

## ◆ get_height()

template<typename Type >

Type clan::Quadx< Type >::get_height | ( |  | ) | const

Returns the height of the quad.

Referenced by clan::Quadx< Type >::get_size().

## ◆ get_size()

template<typename Type >

Sizex< Type > clan::Quadx< Type >::get_size | ( |  | ) | const
| inline

Returns the size of the rectangle.

References clan::Quadx< Type >::get_height(), and clan::Quadx< Type >::get_width().

## ◆ get_width()

template<typename Type >

Type clan::Quadx< Type >::get_width | ( |  | ) | const

Returns the width of the quad.

Referenced by clan::Quadx< Type >::get_size().

## ◆ is_inside()

template<typename Type >

bool clan::Quadx< Type >::is_inside | ( | const Vec2< Type > & | point | ) | const

Check if a point is inside or outside the quad.

## ◆ operator!=()

template<typename Type >

bool clan::Quadx< Type >::operator!= | ( | const Quadx< Type > & | quad | ) | const
| inline

Quad != Quad operator.

References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator+() [1/2]

template<typename Type >

Quadx< Type > clan::Quadx< Type >::operator+ | ( | const Quadx< Type > & | quad | ) | const
| inline

Quad + Quad operator.

References clan::Quadx< Type >::Quadx(), clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator+() [2/2]

template<typename Type >

Quadx< Type > clan::Quadx< Type >::operator+ | ( | const Vec2< Type > & | point | ) | const
| inline

Quad + Point operator.

References clan::Quadx< Type >::Quadx(), clan::Quadx< Type >::p, clan::point, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator+=() [1/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::operator+= | ( | const Quadx< Type > & | quad | ) |
| inline

Quad += Quad operator.

References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator+=() [2/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::operator+= | ( | const Vec2< Type > & | point | ) |
| inline

Quad += Point operator.

References clan::Quadx< Type >::p, clan::point, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator-() [1/2]

template<typename Type >

Quadx< Type > clan::Quadx< Type >::operator- | ( | const Quadx< Type > & | quad | ) | const
| inline

Quad - Quad operator.

References clan::Quadx< Type >::Quadx(), clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator-() [2/2]

template<typename Type >

Quadx< Type > clan::Quadx< Type >::operator- | ( | const Vec2< Type > & | point | ) | const
| inline

Quad - Point operator.

References clan::Quadx< Type >::Quadx(), clan::Quadx< Type >::p, clan::point, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator-=() [1/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::operator-= | ( | const Quadx< Type > & | quad | ) |
| inline

Quad -= Quad operator.

References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator-=() [2/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::operator-= | ( | const Vec2< Type > & | point | ) |
| inline

Quad -= Point operator.

References clan::Quadx< Type >::p, clan::point, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ operator==()

template<typename Type >

bool clan::Quadx< Type >::operator== | ( | const Quadx< Type > & | quad | ) | const
| inline

Quad == Quad operator.

References clan::Quadx< Type >::p, clan::Quadx< Type >::q, clan::Quadx< Type >::r, and clan::Quadx< Type >::s.

## ◆ rotate()

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::rotate | ( | const Vec2< Type > & | hotspot,
|  | const Angle & | angle )

Rotates the Quad.

Parameters

  hotspot | Point to rotate around.
  angle | Angle to rotate in degrees.

Returns
  reference to this object

## ◆ scale() [1/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::scale | ( | const Vec2< Type > & | hotspot,
|  | float | sx,
|  | float | sy )

Scale the Quad.

Parameters

  sx | = Scale value in x-axis
  sy | = Scale value in y-axis
  hotspot | = Point to scale around.

Returns
  reference to this object

## ◆ scale() [2/2]

template<typename Type >

Quadx< Type > & clan::Quadx< Type >::scale | ( | float | sx,
|  | float | sy )

Scale the Quad.

Parameters

  sx | = Scale value in x-axis
  sy | = Scale value in y-axis

Returns
  reference to this object

## Member Data Documentation

## ◆ p

template<typename Type >

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==().

## ◆ q

template<typename Type >

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==().

## ◆ r

template<typename Type >

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==().

## ◆ s

template<typename Type >

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==().

The documentation for this class was generated from the following file:

- quad.h