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

#include <rect.h>

+ Inheritance diagram for clan::Rectd:

Public Member Functions

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

Attributes

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

Detailed Description

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

Member Function Documentation

Rectx<double >& clan::Rectx< double >::apply_alignment ( Origin  origin,
double  x,
double  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<double >& clan::Rectx< double >::bounding_rect ( const Rectx< double > &  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<double >& clan::Rectx< double >::clip ( const Rectx< double > &  cr)
inlineinherited

Clip according to the specified clip rectangle.

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

Returns true if the rectangle contains the point.

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

Expand the rectangle.

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

Expand the rectangle.

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

Expand the rectangle.

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

Returns the bottom-left point outside the rectangle.

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

Returns the bottom-right point outside the rectangle.

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

Returns the center point of the rectangle.

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

Returns the height of the rectangle.

Rectx<double > clan::Rectx< double >::get_rot_bounds ( const Vec2< double > &  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<double > clan::Rectx< double >::get_rot_bounds ( Origin  origin,
double  x,
double  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<double > clan::Rectx< double >::get_size ( ) const
inlineinherited

Returns the size of the rectangle.

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

Returns the top-left point inside the rectangle.

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

Returns the top-right point outside the rectangle.

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

Returns the width of the rectangle.

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

Returns true if rectangle passed is inside this rectangle.

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

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

Rectx<double >& clan::Rectx< double >::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< double >::operator!= ( const Rectx< double > &  r) const
inlineinherited

Rect != Rect operator.

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

Rect == Rect operator.

Rectx<double >& clan::Rectx< double >::overlap ( const Rectx< double > &  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<double >& clan::Rectx< double >::set_height ( double  height)
inlineinherited

Sets the height of the rectangle.

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

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

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

Sets the top-left point of the rectangle.

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

Sets the width of the rectangle.

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

Shrink the rectangle.

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

Shrink the rectangle.

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

Shrink the rectangle.

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

Translate the rect.

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

Translate the rect.

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

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

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

Translate the rect.

Returns
reference to this object

Member Data Documentation

double clan::Rectx< double >::bottom
inherited

Y2-coordinate (point outside the rectange)

double clan::Rectx< double >::left
inherited

X1-coordinate (left point inside the rectangle)

double clan::Rectx< double >::right
inherited

X2-coordinate (point outside the rectangle)

double clan::Rectx< double >::top
inherited

Y1-coordinate (top point inside the rectangle)


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