ContRap-Libraries
Public Member Functions | Protected Attributes

crp::Rect2D Class Reference

Class Rect2D is a rectangle representation. More...

#include <primitives.h>

Inheritance diagram for crp::Rect2D:
crp::Primitive2D

Public Member Functions

 Rect2D (double start_x=0.0, double start_y=0.0, double end_x=0.0, double end_y=0.0)
 Creates a new rectangle.
 Rect2D (const Rect2D &primitive)
 Copy constructor.
Rect2Doperator= (const Rect2D &primitive)
 Assignment operator.
virtual Type get_type () const
 Type of the primitive.
double get_end_x () const
 Returns the x-Coordinate.
double get_end_y () const
 Returns the y-Coordinate.
double get_width () const
 Returns the width.
double get_height () const
 Returns the height.
void set_width (double width)
 Sets the width of the rect.
void set_height (double height)
 Sets the height of the rect.
void set_end (double x, double y)
 Sets the opposite position to the start point.
virtual Primitive2Dget_copy ()
 Copies the current primitive.

Protected Attributes

double dx
 Displacement of the rectangle.
double dy

Detailed Description

Class Rect2D is a rectangle representation.


Constructor & Destructor Documentation

crp::Rect2D::Rect2D ( double  start_x = 0.0,
double  start_y = 0.0,
double  end_x = 0.0,
double  end_y = 0.0 
) [inline]

Creates a new rectangle.

Parameters:
start_xX-Coordinate of the start point
start_yY-Coordinate of the start point
end_xX-Coordinate of the end point
end_yY-Coordinate of the end point
crp::Rect2D::Rect2D ( const Rect2D primitive) [inline]

Copy constructor.

Parameters:
primitivePrimitive to copy

Member Function Documentation

virtual Primitive2D* crp::Rect2D::get_copy ( ) [inline, virtual]

Copies the current primitive.

Returns:
New copy of the current primitive

Implements crp::Primitive2D.

double crp::Rect2D::get_end_x ( ) const [inline]

Returns the x-Coordinate.

Returns:
x-Coordinate
double crp::Rect2D::get_end_y ( ) const [inline]

Returns the y-Coordinate.

Returns:
y-Coordinate
double crp::Rect2D::get_height ( ) const [inline]

Returns the height.

virtual Type crp::Rect2D::get_type ( ) const [inline, virtual]

Type of the primitive.

Returns:
Type of the primitive

Implements crp::Primitive2D.

double crp::Rect2D::get_width ( ) const [inline]

Returns the width.

Reimplemented from crp::Primitive2D.

Rect2D& crp::Rect2D::operator= ( const Rect2D primitive) [inline]

Assignment operator.

Parameters:
primitiveObject to assign
void crp::Rect2D::set_end ( double  x,
double  y 
) [inline]

Sets the opposite position to the start point.

Parameters:
xNew X-Coordinate
yNew Y-Coordinate
void crp::Rect2D::set_height ( double  height) [inline]

Sets the height of the rect.

Parameters:
heightNew height
void crp::Rect2D::set_width ( double  width) [inline, virtual]

Sets the width of the rect.

Parameters:
widthNew width

Reimplemented from crp::Primitive2D.


Field Documentation

double crp::Rect2D::dx [protected]

Displacement of the rectangle.

double crp::Rect2D::dy [protected]

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