KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Friends | List of all members
kjb::Axis_aligned_rectangle_2d Class Reference

Class that represents an axis-aligned 2D rectangle. It is defined in terms of its (2D) center, its width and its height. More...

#include <gr_2D_bounding_box.h>

Public Member Functions

 Axis_aligned_rectangle_2d (const Vector &center=Vector(2, 0.0), double width=1.0, double height=1.0)
 Constructs a Axis_aligned_rectangle_2d. More...
 
 Axis_aligned_rectangle_2d (const Vector &p1, const Vector &p2)
 Constructs a Axis_aligned_rectangle_2d. More...
 
Axis_aligned_rectangle_2dclone () const
 Clones this Axis_aligned_rectangle_2d. More...
 
 ~Axis_aligned_rectangle_2d ()
 Deletes this Axis_aligned_rectangle_2d. More...
 
const Vectorget_center () const
 returns the center of this Axis_aligned_rectangle_2d More...
 
double get_width () const
 returns the width of this bounding box More...
 
double get_height () const
 returns the height of this bounding box More...
 
double get_left () const
 
double get_right () const
 
double get_bottom () const
 
double get_top () const
 
Vector get_top_left () const
 
Vector get_bottom_right () const
 
Vector get_top_center () const
 
Vector get_bottom_center () const
 
void set_center (const Vector &center)
 sets the center of this bounding box More...
 
void set_width (double width)
 sets the width of this bounding box More...
 
void set_height (double height)
 sets the height of this bounding box More...
 
void wire_render () const
 
bool contains (const kjb::Vector &pt) const
 
bool intersects (const Self &other) const
 
void draw (kjb::Image &img, double ir=255, double ig=0, double ib=0, double iwidth=1.0) const
 
void write_corners_on (std::ostream &ofs)
 
void swap (Axis_aligned_rectangle_2d &r)
 Swaps this rectangle with another. More...
 
 Axis_aligned_rectangle_2d (double center_x, double center_y, double iwidth, double iheight)
 Constructs a Axis_aligned_rectangle_2d. More...
 
const Vectorget_centre () const
 returns the center of this Axis_aligned_rectangle_2d More...
 
double get_centre_x () const
 returns the x-coordinate of the center of this Axis_aligned_rectangle_2d More...
 
double get_centre_y () const
 returns the y-coordinate of the center of this Axis_aligned_rectangle_2d More...
 
double get_area () const
 returns the area of the box More...
 
void set_centre (const Vector &icenter)
 sets the center of this bounding box More...
 
void set_centre_x (double center_x)
 sets the x-coordinate of the center of this bounding box More...
 
void set_centre_y (double center_y)
 sets the y-coordinate of the center of this bounding box More...
 

Friends

std::ostream & operator<< (std::ostream &ost, const Axis_aligned_rectangle_2d &box)
 
std::istream & operator>> (std::istream &ist, Axis_aligned_rectangle_2d &box)
 

Detailed Description

Class that represents an axis-aligned 2D rectangle. It is defined in terms of its (2D) center, its width and its height.

Constructor & Destructor Documentation

kjb::Axis_aligned_rectangle_2d::Axis_aligned_rectangle_2d ( const Vector center = Vector(2, 0.0),
double  width = 1.0,
double  height = 1.0 
)
inline
kjb::Axis_aligned_rectangle_2d::Axis_aligned_rectangle_2d ( const Vector p1,
const Vector p2 
)
inline
kjb::Axis_aligned_rectangle_2d::~Axis_aligned_rectangle_2d ( )
inline
kjb::Axis_aligned_rectangle_2d::Axis_aligned_rectangle_2d ( double  center_x,
double  center_y,
double  iwidth,
double  iheight 
)
inline

Member Function Documentation

Axis_aligned_rectangle_2d* kjb::Axis_aligned_rectangle_2d::clone ( ) const
inline
bool kjb::Axis_aligned_rectangle_2d::contains ( const kjb::Vector pt) const
inline

Returns true if pt lies inside this box

void kjb::Bounding_Box2D::draw ( kjb::Image img,
double  ir = 255,
double  ig = 0,
double  ib = 0,
double  iwidth = 1.0 
) const
double kjb::Axis_aligned_rectangle_2d::get_area ( ) const
inline

returns the area of the box

double kjb::Axis_aligned_rectangle_2d::get_bottom ( ) const
inline
Vector kjb::Axis_aligned_rectangle_2d::get_bottom_center ( ) const
inline
Vector kjb::Axis_aligned_rectangle_2d::get_bottom_right ( ) const
inline
const Vector& kjb::Axis_aligned_rectangle_2d::get_center ( ) const
inline

returns the center of this Axis_aligned_rectangle_2d

const Vector& kjb::Axis_aligned_rectangle_2d::get_centre ( ) const
inline

returns the center of this Axis_aligned_rectangle_2d

double kjb::Axis_aligned_rectangle_2d::get_centre_x ( ) const
inline

returns the x-coordinate of the center of this Axis_aligned_rectangle_2d

double kjb::Axis_aligned_rectangle_2d::get_centre_y ( ) const
inline

returns the y-coordinate of the center of this Axis_aligned_rectangle_2d

double kjb::Axis_aligned_rectangle_2d::get_height ( ) const
inline

returns the height of this bounding box

double kjb::Axis_aligned_rectangle_2d::get_left ( ) const
inline
double kjb::Axis_aligned_rectangle_2d::get_right ( ) const
inline
double kjb::Axis_aligned_rectangle_2d::get_top ( ) const
inline
Vector kjb::Axis_aligned_rectangle_2d::get_top_center ( ) const
inline
Vector kjb::Axis_aligned_rectangle_2d::get_top_left ( ) const
inline
double kjb::Axis_aligned_rectangle_2d::get_width ( ) const
inline

returns the width of this bounding box

bool kjb::Axis_aligned_rectangle_2d::intersects ( const Self other) const
inline
void kjb::Axis_aligned_rectangle_2d::set_center ( const Vector center)
inline

sets the center of this bounding box

void kjb::Axis_aligned_rectangle_2d::set_centre ( const Vector icenter)
inline

sets the center of this bounding box

void kjb::Axis_aligned_rectangle_2d::set_centre_x ( double  center_x)
inline

sets the x-coordinate of the center of this bounding box

void kjb::Axis_aligned_rectangle_2d::set_centre_y ( double  center_y)
inline

sets the y-coordinate of the center of this bounding box

void kjb::Axis_aligned_rectangle_2d::set_height ( double  height)
inline

sets the height of this bounding box

void kjb::Axis_aligned_rectangle_2d::set_width ( double  width)
inline

sets the width of this bounding box

void kjb::Axis_aligned_rectangle_2d::swap ( Axis_aligned_rectangle_2d r)
inline

Swaps this rectangle with another.

void kjb::Bounding_Box2D::wire_render ( ) const
void kjb::Bounding_Box2D::write_corners_on ( std::ostream &  ofs)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ost,
const Axis_aligned_rectangle_2d box 
)
friend
std::istream& operator>> ( std::istream &  ist,
Axis_aligned_rectangle_2d box 
)
friend

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