Public Member Functions

CL_Rectd Class Reference
[clanCore Math]

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

#include <rect.h>

Inheritance diagram for CL_Rectd:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CL_Rectd ()
 CL_Rectd (double new_left, double new_top, const CL_Sizex< double > &size)
 CL_Rectd (const CL_Rectx< double > &rect)
 CL_Rectd (const CL_Rectx< float > &rect)
 CL_Rectd (const CL_Rectx< int > &rect)
 CL_Rectd (const CL_Pointx< double > &p, const CL_Sizex< double > &size)
 CL_Rectd (double new_left, double new_top, double new_right, double new_bottom)
 CL_Rectd (const CL_Sizex< double > &s)
 CL_Rectd (const CL_Sizex< float > &s)
 CL_Rectd (const CL_Sizex< int > &s)
Construction

bool operator== (const CL_Rectx< double > &r) const
 Rect == Rect operator.
bool operator!= (const CL_Rectx< double > &r) const
 Rect != Rect operator.
Operations

CL_Rectx< double > & set_top_left (const CL_Vec2< double > &p)
 Sets the top-left point of the rectangle.
CL_Rectx< double > & set_top_right (const CL_Vec2< double > &p)
 Sets the top-right point of the rectangle.
CL_Rectx< double > & set_bottom_right (const CL_Vec2< double > &p)
 Sets the bottom-right point of the rectangle.
CL_Rectx< double > & set_bottom_left (const CL_Vec2< double > &p)
 Sets the bottom-left point of the rectangle.
CL_Rectx< double > & set_width (doublewidth)
 Sets the width of the rectangle.
CL_Rectx< double > & set_height (doubleheight)
 Sets the height of the rectangle.
CL_Rectx< double > & shrink (const double &left, const double &top, const double &right, const double &bottom)
 Shrink the rectangle.
CL_Rectx< double > & shrink (const double &left_right, const double &top_bottom)
 Shrink the rectangle.
CL_Rectx< double > & shrink (const double &shrink)
 Shrink the rectangle.
CL_Rectx< double > & expand (const double &left, const double &top, const double &right, const double &bottom)
 Expand the rectangle.
CL_Rectx< double > & expand (const double &left_and_right, const double &top_and_bottom)
 Expand the rectangle.
CL_Rectx< double > & expand (const double &expand)
 Expand the rectangle.
CL_Rectx< double > & translate (const CL_Vec2< double > &p)
 Translate the rect.
CL_Rectx< double > & translate (const CL_Rectx< double > &p)
 Translate the rect by another rect (only uses the left and top coords).
CL_Rectx< double > & translate (doublex, doubley)
 Translate the rect.
CL_Rectx< double > & set_size (const CL_Sizex< double > &size)
 Sets the size of the rectangle, maintaining top/left position.
CL_Rectx< double > & overlap (const CL_Rectx< double > &rect)
 Calculates the intersection of two rectangles.
CL_Rectx< double > & bounding_rect (const CL_Rectx< double > &rect)
 Calculates the bounding rectangle of the rectangles.
CL_Rectx< double > & normalize ()
 Normalize rectangle. Ensures that left is less than right and top is less than bottom.
CL_Rectx< double > & apply_alignment (CL_Origin origin, doublex, doubley)
 Applies an origin and offset pair to this rectangle.
CL_Rectx< double > & clip (const CL_Rectx< double > &cr)
 Clip according to the specified clip rectangle.

Attributes



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

Detailed Description

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


Constructor & Destructor Documentation

CL_Rectd::CL_Rectd (  )  [inline]
CL_Rectd::CL_Rectd ( const CL_Sizex< int > &  s  )  [inline]
CL_Rectd::CL_Rectd ( const CL_Sizex< float > &  s  )  [inline]
CL_Rectd::CL_Rectd ( const CL_Sizex< double > &  s  )  [inline]
CL_Rectd::CL_Rectd ( double  new_left,
double  new_top,
double  new_right,
double  new_bottom 
) [inline]
CL_Rectd::CL_Rectd ( const CL_Pointx< double > &  p,
const CL_Sizex< double > &  size 
) [inline]
CL_Rectd::CL_Rectd ( const CL_Rectx< int > &  rect  )  [inline]
CL_Rectd::CL_Rectd ( const CL_Rectx< float > &  rect  )  [inline]
CL_Rectd::CL_Rectd ( const CL_Rectx< double > &  rect  )  [inline]
CL_Rectd::CL_Rectd ( double  new_left,
double  new_top,
const CL_Sizex< double > &  size 
) [inline]

Member Function Documentation

CL_Rectx<double >& CL_Rectx< double >::apply_alignment ( CL_Origin  origin,
double  x,
double  y 
) [inline, inherited]

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
CL_Rectx<double >& CL_Rectx< double >::bounding_rect ( const CL_Rectx< double > &  rect  )  [inline, inherited]

Calculates the bounding rectangle of the rectangles.

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

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::clip ( const CL_Rectx< double > &  cr  )  [inline, inherited]

Clip according to the specified clip rectangle.

Returns:
reference to this object
bool CL_Rectx< double >::contains ( const CL_Vec2< double > &  p  )  const [inline, inherited]

Returns true if the rectangle contains the point.

CL_Rectx<double >& CL_Rectx< double >::expand ( const double &  left,
const double &  top,
const double &  right,
const double &  bottom 
) [inline, inherited]

Expand the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::expand ( const double &  left_and_right,
const double &  top_and_bottom 
) [inline, inherited]

Expand the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::expand ( const double &  expand  )  [inline, inherited]

Expand the rectangle.

Returns:
reference to this object
CL_Pointx<double > CL_Rectx< double >::get_bottom_left (  )  const [inline, inherited]

Returns the bottom-left point of the rectangle.

CL_Pointx<double > CL_Rectx< double >::get_bottom_right (  )  const [inline, inherited]

Returns the bottom-right point of the rectangle.

CL_Pointx<double > CL_Rectx< double >::get_center (  )  const [inline, inherited]

Returns the center point of the rectangle.

double CL_Rectx< double >::get_height (  )  const [inline, inherited]

Returns the height of the rectangle.

CL_Rectx<double > CL_Rectx< double >::get_rot_bounds ( const CL_Vec2< double > &  hotspot,
const CL_Angle angle 
) const [inherited]

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

Parameters:
hotspot Point to rotate around.
angle Angle to rotate.
CL_Rectx<double > CL_Rectx< double >::get_rot_bounds ( CL_Origin  origin,
double  x,
double  y,
const CL_Angle angle 
) const [inherited]

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

Parameters:
origin Determines the hotspot point within the rectangle
x Offsets applied negatively to the hotspot point
y Offsets applied negatively to the hotspot point
angle Angle
CL_Sizex<double > CL_Rectx< double >::get_size (  )  const [inline, inherited]

Returns the size of the rectangle.

CL_Pointx<double > CL_Rectx< double >::get_top_left (  )  const [inline, inherited]

Returns the top-left point of the rectangle.

CL_Pointx<double > CL_Rectx< double >::get_top_right (  )  const [inline, inherited]

Returns the top-right point of the rectangle.

double CL_Rectx< double >::get_width (  )  const [inline, inherited]

Returns the width of the rectangle.

bool CL_Rectx< double >::is_inside ( const CL_Rectx< double > &  r  )  const [inline, inherited]

Returns true if rectangle passed is inside this rectangle.

bool CL_Rectx< double >::is_overlapped ( const CL_Rectx< double > &  r  )  const [inline, inherited]

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

CL_Rectx<double >& CL_Rectx< double >::normalize (  )  [inline, inherited]

Normalize rectangle. Ensures that left is less than right and top is less than bottom.

Returns:
reference to this object
bool CL_Rectx< double >::operator!= ( const CL_Rectx< double > &  r  )  const [inline, inherited]

Rect != Rect operator.

bool CL_Rectx< double >::operator== ( const CL_Rectx< double > &  r  )  const [inline, inherited]

Rect == Rect operator.

CL_Rectx<double >& CL_Rectx< double >::overlap ( const CL_Rectx< double > &  rect  )  [inline, inherited]

Calculates the intersection of two rectangles.

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

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_bottom_left ( const CL_Vec2< double > &  p  )  [inline, inherited]

Sets the bottom-left point of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_bottom_right ( const CL_Vec2< double > &  p  )  [inline, inherited]

Sets the bottom-right point of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_height ( double  height  )  [inline, inherited]

Sets the height of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_size ( const CL_Sizex< double > &  size  )  [inline, inherited]

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

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_top_left ( const CL_Vec2< double > &  p  )  [inline, inherited]

Sets the top-left point of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_top_right ( const CL_Vec2< double > &  p  )  [inline, inherited]

Sets the top-right point of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::set_width ( double  width  )  [inline, inherited]

Sets the width of the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::shrink ( const double &  left,
const double &  top,
const double &  right,
const double &  bottom 
) [inline, inherited]

Shrink the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::shrink ( const double &  shrink  )  [inline, inherited]

Shrink the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::shrink ( const double &  left_right,
const double &  top_bottom 
) [inline, inherited]

Shrink the rectangle.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::translate ( const CL_Vec2< double > &  p  )  [inline, inherited]

Translate the rect.

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::translate ( const CL_Rectx< double > &  p  )  [inline, inherited]

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

Returns:
reference to this object
CL_Rectx<double >& CL_Rectx< double >::translate ( double  x,
double  y 
) [inline, inherited]

Translate the rect.

Returns:
reference to this object

Member Data Documentation

double CL_Rectx< double >::bottom [inherited]

Y2-coordinate.

double CL_Rectx< double >::left [inherited]

X1-coordinate.

double CL_Rectx< double >::right [inherited]

X2-coordinate.

double CL_Rectx< double >::top [inherited]

Y1-coordinate.


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