2D (left,top,right,bottom) rectangle structure - Float More...

#include <rect.h>

+ Inheritance diagram for clan::Rectf:

Public Member Functions

 Rectf ()
 
 Rectf (const Sizex< int > &s)
 
 Rectf (const Sizex< float > &s)
 
 Rectf (float new_left, float new_top, float new_right, float new_bottom)
 
 Rectf (const Pointx< float > &p, const Sizex< float > &size)
 
 Rectf (const Rectx< int > &rect)
 
 Rectf (const Rectx< float > &rect)
 
 Rectf (const Rectx< double > &rect)
 
 Rectf (float new_left, float new_top, const Sizex< float > &size)
 
Construction
bool operator== (const Rectx< float > &r) const
 Rect == Rect operator. More...
 
bool operator!= (const Rectx< float > &r) const
 Rect != Rect operator. More...
 
Operations
Rectx< float > & set_top_left (const Vec2< float > &p)
 Sets the top-left point of the rectangle. More...
 
Rectx< float > & set_width (floatwidth)
 Sets the width of the rectangle. More...
 
Rectx< float > & set_height (floatheight)
 Sets the height of the rectangle. More...
 
Rectx< float > & shrink (const float &left, const float &top, const float &right, const float &bottom)
 Shrink the rectangle. More...
 
Rectx< float > & shrink (const float &left_right, const float &top_bottom)
 Shrink the rectangle. More...
 
Rectx< float > & shrink (const float &shrink)
 Shrink the rectangle. More...
 
Rectx< float > & expand (const float &left, const float &top, const float &right, const float &bottom)
 Expand the rectangle. More...
 
Rectx< float > & expand (const float &left_and_right, const float &top_and_bottom)
 Expand the rectangle. More...
 
Rectx< float > & expand (const float &expand)
 Expand the rectangle. More...
 
Rectx< float > & translate (const Vec2< float > &p)
 Translate the rect. More...
 
Rectx< float > & translate (const Sizex< float > &p)
 Translate the rect. More...
 
Rectx< float > & translate (const Rectx< float > &p)
 Translate the rect by another rect (only uses the left and top coords). More...
 
Rectx< float > & translate (floatx, floaty)
 Translate the rect. More...
 
Rectx< float > & set_size (const Sizex< float > &size)
 Sets the size of the rectangle, maintaining top/left position. More...
 
Rectx< float > & overlap (const Rectx< float > &rect)
 Calculates the intersection of two rectangles. More...
 
Rectx< float > & bounding_rect (const Rectx< float > &rect)
 Calculates the bounding rectangle of the rectangles. More...
 
Rectx< float > & normalize ()
 Normalize rectangle. More...
 
Rectx< float > & apply_alignment (Origin origin, floatx, floaty)
 Applies an origin and offset pair to this rectangle. More...
 
Rectx< float > & clip (const Rectx< float > &cr)
 Clip according to the specified clip rectangle. More...
 

Attributes

float get_width () const
 Returns the width of the rectangle. More...
 
float get_height () const
 Returns the height of the rectangle. More...
 
Sizex< float > get_size () const
 Returns the size of the rectangle. More...
 
bool contains (const Vec2< float > &p) const
 Returns true if the rectangle contains the point. More...
 
Pointx< float > get_top_left () const
 Returns the top-left point inside the rectangle. More...
 
Pointx< float > get_top_right () const
 Returns the top-right point outside the rectangle. More...
 
Pointx< float > get_bottom_right () const
 Returns the bottom-right point outside the rectangle. More...
 
Pointx< float > get_bottom_left () const
 Returns the bottom-left point outside the rectangle. More...
 
bool is_overlapped (const Rectx< float > &r) const
 Returns true if rectangle passed is overlapping or inside this rectangle. More...
 
bool is_inside (const Rectx< float > &r) const
 Returns true if rectangle passed is inside this rectangle. More...
 
Rectx< float > get_rot_bounds (const Vec2< float > &hotspot, const Angle &angle) const
 Returns another Rectx<Type> containing a rotated version of this one. More...
 
Rectx< float > get_rot_bounds (Origin origin, floatx, floaty, const Angle &angle) const
 Returns another Rectx<Type> containing a rotated version of this one. More...
 
Pointx< float > get_center () const
 Returns the center point of the rectangle. More...
 
float left
 X1-coordinate (left point inside the rectangle) More...
 
float top
 Y1-coordinate (top point inside the rectangle) More...
 
float right
 X2-coordinate (point outside the rectangle) More...
 
float bottom
 Y2-coordinate (point outside the rectange) More...
 

Detailed Description

2D (left,top,right,bottom) rectangle structure - Float

Member Function Documentation

Rectx<float >& clan::Rectx< float >::apply_alignment ( Origin  origin,
float  x,
float  y 
)
inlineinherited

Applies an origin and offset pair to this rectangle.

Parameters
originThe new origin to adjust to from default upper-left position
x,yOffsets applied negatively to each corner of the rectangle
Returns
reference to this object
Rectx<float >& clan::Rectx< float >::bounding_rect ( const Rectx< float > &  rect)
inlineinherited

Calculates the bounding rectangle of the rectangles.

Rect values become: min left, min top, max right, max bottom.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::clip ( const Rectx< float > &  cr)
inlineinherited

Clip according to the specified clip rectangle.

Returns
reference to this object
bool clan::Rectx< float >::contains ( const Vec2< float > &  p) const
inlineinherited

Returns true if the rectangle contains the point.

Rectx<float >& clan::Rectx< float >::expand ( const float &  left,
const float &  top,
const float &  right,
const float &  bottom 
)
inlineinherited

Expand the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::expand ( const float &  left_and_right,
const float &  top_and_bottom 
)
inlineinherited

Expand the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::expand ( const float &  expand)
inlineinherited

Expand the rectangle.

Returns
reference to this object
Pointx<float > clan::Rectx< float >::get_bottom_left ( ) const
inlineinherited

Returns the bottom-left point outside the rectangle.

Pointx<float > clan::Rectx< float >::get_bottom_right ( ) const
inlineinherited

Returns the bottom-right point outside the rectangle.

Pointx<float > clan::Rectx< float >::get_center ( ) const
inlineinherited

Returns the center point of the rectangle.

float clan::Rectx< float >::get_height ( ) const
inlineinherited

Returns the height of the rectangle.

Rectx<float > clan::Rectx< float >::get_rot_bounds ( const Vec2< float > &  hotspot,
const Angle angle 
) const
inherited

Returns another Rectx<Type> containing a rotated version of this one.

Parameters
hotspotPoint to rotate around.
angleAngle to rotate.
Rectx<float > clan::Rectx< float >::get_rot_bounds ( Origin  origin,
float  x,
float  y,
const Angle angle 
) const
inherited

Returns another Rectx<Type> containing a rotated version of this one.

Parameters
originDetermines the hotspot point within the rectangle
xOffsets applied negatively to the hotspot point
yOffsets applied negatively to the hotspot point
angleAngle
Sizex<float > clan::Rectx< float >::get_size ( ) const
inlineinherited

Returns the size of the rectangle.

Pointx<float > clan::Rectx< float >::get_top_left ( ) const
inlineinherited

Returns the top-left point inside the rectangle.

Pointx<float > clan::Rectx< float >::get_top_right ( ) const
inlineinherited

Returns the top-right point outside the rectangle.

float clan::Rectx< float >::get_width ( ) const
inlineinherited

Returns the width of the rectangle.

bool clan::Rectx< float >::is_inside ( const Rectx< float > &  r) const
inlineinherited

Returns true if rectangle passed is inside this rectangle.

bool clan::Rectx< float >::is_overlapped ( const Rectx< float > &  r) const
inlineinherited

Returns true if rectangle passed is overlapping or inside this rectangle.

Rectx<float >& clan::Rectx< float >::normalize ( )
inlineinherited

Normalize rectangle.

Sets the width to 0 if found a negative width Sets the height to 0 if found a negative height

Returns
reference to this object
bool clan::Rectx< float >::operator!= ( const Rectx< float > &  r) const
inlineinherited

Rect != Rect operator.

bool clan::Rectx< float >::operator== ( const Rectx< float > &  r) const
inlineinherited

Rect == Rect operator.

Rectx<float >& clan::Rectx< float >::overlap ( const Rectx< float > &  rect)
inlineinherited

Calculates the intersection of two rectangles.

Rect values become: max left, max top, min right, min bottom.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::set_height ( float  height)
inlineinherited

Sets the height of the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::set_size ( const Sizex< float > &  size)
inlineinherited

Sets the size of the rectangle, maintaining top/left position.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::set_top_left ( const Vec2< float > &  p)
inlineinherited

Sets the top-left point of the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::set_width ( float  width)
inlineinherited

Sets the width of the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::shrink ( const float &  left,
const float &  top,
const float &  right,
const float &  bottom 
)
inlineinherited

Shrink the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::shrink ( const float &  left_right,
const float &  top_bottom 
)
inlineinherited

Shrink the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::shrink ( const float &  shrink)
inlineinherited

Shrink the rectangle.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::translate ( const Vec2< float > &  p)
inlineinherited

Translate the rect.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::translate ( const Sizex< float > &  p)
inlineinherited

Translate the rect.

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::translate ( const Rectx< float > &  p)
inlineinherited

Translate the rect by another rect (only uses the left and top coords).

Returns
reference to this object
Rectx<float >& clan::Rectx< float >::translate ( float  x,
float  y 
)
inlineinherited

Translate the rect.

Returns
reference to this object

Member Data Documentation

float clan::Rectx< float >::bottom
inherited

Y2-coordinate (point outside the rectange)

float clan::Rectx< float >::left
inherited

X1-coordinate (left point inside the rectangle)

float clan::Rectx< float >::right
inherited

X2-coordinate (point outside the rectangle)

float clan::Rectx< float >::top
inherited

Y1-coordinate (top point inside the rectangle)


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