feisty meow concerns codebase  2.140
geometric::screen_rectangle Class Reference

Represents a rectangle as interpreted on display screens. More...

#include <screen_rectangle.h>

Inheritance diagram for geometric::screen_rectangle:
Collaboration diagram for geometric::screen_rectangle:

Public Member Functions

 screen_rectangle (const screen_point &vertex_1, const screen_point &vertex_2)
 
 screen_rectangle (int x_1=0, int y_1=0, int x_2=0, int y_2=0)
 
 screen_rectangle (const rectangle< int > &init)
 
screen_rectangle order () const
 Re-orders the vertices to match expectations. More...
 
screen_point top_left () const
 
screen_point bottom_left () const
 
screen_point top_right () const
 
screen_point bottom_right () const
 
int left () const
 
int top () const
 
int right () const
 
int bottom () const
 
- Public Member Functions inherited from geometric::rectangle< int >
 rectangle (const point< int > &vertex_1, const point< int > &vertex_2)
 
 rectangle (int x_1=0, int y_1=0, int x_2=0, int y_2=0)
 
int height () const
 
int width () const
 
rectangle order () const
 Re-orders the vertices of the line to be increasing. More...
 
point< int > top_left () const
 
point< int > bottom_left () const
 
point< int > top_right () const
 
point< int > bottom_right () const
 returns the appropriate point as represented by our rectangle. More...
 
int minimum_x () const
 Return the smallest x from the points in the rectangle. More...
 
int minimum_y () const
 Return the smallest y from the points in the rectangle. More...
 
int maximum_x () const
 Return the largest x from the points in the rectangle. More...
 
int maximum_y () const
 Return the largest y from the points in the rectangle. More...
 
point< int > center () const
 Returns the point at the center of the rectangle. More...
 
bool inside (const point< int > &to_check) const
 Returns true if ‘to_check’ is inside ‘this’ rectangle. More...
 
bool operator== (const rectangle &to_compare) const
 Returns true if ‘to_compare’ has vertices equal to ‘this’. More...
 
rectangle operator+ (const point< int > &to_add) const
 Returns the rectangle resulting from adding a point to its vertices. More...
 
rectangle operator- (const point< int > &to_subtract) const
 Returns the rectangle resulting from subtracting "to_subtract". More...
 
rectangleoperator+= (const point< int > &to_add)
 Adds the point "to_add" to our vertices. More...
 
rectangleoperator-= (const point< int > &to_subtract)
 Subtracts the point "to_add" to our vertices. More...
 
void encompass (const rectangle &to_adjust_to)
 Finds the largest dimension needed to contain all rectangles passed in. More...
 
bool intersect (const rectangle &r2) const
 Returns true if ‘this’ & ‘r2’ cover any common points. More...
 
bool disjoint (const rectangle &r2) const
 Returns true if ‘this’ & ‘r2’ have mutually exclusive extents. More...
 
bool join_intersecting (const rectangle &r2, rectangle &result)
 Sets "result" to encompass this and "r2" if they intersect. More...
 
bool intersection (const rectangle &r2, rectangle &result)
 Sets "result" to the intersection of this and "r2". More...
 
basis::astring text_form () const
 Prints out the contents of the rectangle. More...
 
bool from_text (const basis::astring &text)
 Returns true if the "text" is parsed into this rectangle. More...
 
point< int > vertex_1 () const
 
void vertex_1 (const point< int > &to_set)
 
point< int > vertex_2 () const
 
void vertex_2 (const point< int > &to_set)
 
virtual int packed_size () const
 Estimates the space needed for the packed structure. More...
 
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form". More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form". More...
 

Additional Inherited Members

- Protected Attributes inherited from geometric::rectangle< int >
point< int > _vertex_1
 
point< int > _vertex_2
 

Detailed Description

Represents a rectangle as interpreted on display screens.

The origin is the top-left corner of the rectangle and the y coordinate gets larger as one goes downwards. This class is primarily useful in conjunction with a windowing environment.

Definition at line 62 of file screen_rectangle.h.

Constructor & Destructor Documentation

◆ screen_rectangle() [1/3]

geometric::screen_rectangle::screen_rectangle ( const screen_point vertex_1,
const screen_point vertex_2 
)

Definition at line 45 of file screen_rectangle.cpp.

Referenced by order().

◆ screen_rectangle() [2/3]

geometric::screen_rectangle::screen_rectangle ( int  x_1 = 0,
int  y_1 = 0,
int  x_2 = 0,
int  y_2 = 0 
)

Definition at line 49 of file screen_rectangle.cpp.

◆ screen_rectangle() [3/3]

geometric::screen_rectangle::screen_rectangle ( const rectangle< int > &  init)

Definition at line 42 of file screen_rectangle.cpp.

Member Function Documentation

◆ bottom()

int geometric::screen_rectangle::bottom ( ) const
inline

Definition at line 82 of file screen_rectangle.h.

References bottom_right(), and geometric::point< numeric_type >::y().

◆ bottom_left()

screen_point geometric::screen_rectangle::bottom_left ( ) const

◆ bottom_right()

screen_point geometric::screen_rectangle::bottom_right ( ) const

Definition at line 64 of file screen_rectangle.cpp.

References geometric::rectangle< numeric_type >::top_right().

Referenced by bottom(), order(), and right().

◆ left()

int geometric::screen_rectangle::left ( ) const
inline

Definition at line 79 of file screen_rectangle.h.

References top_left(), and geometric::point< numeric_type >::x().

◆ order()

screen_rectangle geometric::screen_rectangle::order ( ) const

Re-orders the vertices to match expectations.

This is just like rectangle::order() except that the first vertex will be closest to the top-left of the screen.

Definition at line 52 of file screen_rectangle.cpp.

References bottom_right(), screen_rectangle(), and top_left().

◆ right()

int geometric::screen_rectangle::right ( ) const
inline

Definition at line 81 of file screen_rectangle.h.

References bottom_right(), and geometric::point< numeric_type >::x().

◆ top()

int geometric::screen_rectangle::top ( ) const
inline

Definition at line 80 of file screen_rectangle.h.

References top_left(), and geometric::point< numeric_type >::y().

◆ top_left()

screen_point geometric::screen_rectangle::top_left ( ) const

Definition at line 55 of file screen_rectangle.cpp.

References geometric::rectangle< numeric_type >::bottom_left().

Referenced by left(), order(), and top().

◆ top_right()

screen_point geometric::screen_rectangle::top_right ( ) const

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