ALBULA  4.0.1
dectris.albula.DRect Class Reference


The DRect class defines a rectangle in the plane using integer precision. More...

Public Member Functions

def DRect ()
 Default constructor. More...
 
def DRect (left, top, width, height)
 Construct DRect with its upper left corner at (left,top) and width and height. More...
 
def DRect (rect)
 Copy constructor. More...
 
def left ()
 
def right ()
 Same as left() + width() More...
 
def top ()
 
def bottom ()
 Same as top() + height() More...
 
def width ()
 
def height ()
 
def setLeft (x)
 Sets the left edge of the rectangle to the given x coordinate holding width() and height() constant. More...
 
def setRight (x)
 Sets the right edge of the rectangle to the given x coordinate holding width() and height() constant. More...
 
def setTop (y)
 Sets the top edge of the rectangle to the given y-coordinate holding width() and height() constant. More...
 
def setBottom (y)
 Sets the bottom edge of the rectangle to the given y-coordinate holding width() and height() constant. More...
 
def setWidth (width)
 
Sets the rectangle's width holding left() constant. More...
 
def setHeight (height)
 
Sets the rectangle's height holding top() constant. More...
 
def move (dx, dy)
 move the rectangle by dx, dy holding width() and height() constant. More...
 

Detailed Description


The DRect class defines a rectangle in the plane using integer precision.

class DRect provides the following operations:

DRect == rectComparison operator
Returns
true if the rectangle is equal to rect else false
DRect != rect
Returns
true if the rectangle is different from rect else false

Constructor & Destructor Documentation

◆ DRect() [1/3]

def dectris.albula.DRect.DRect ( )

Default constructor.

◆ DRect() [2/3]

def dectris.albula.DRect.DRect (   left,
  top,
  width,
  height 
)

Construct DRect with its upper left corner at (left,top) and width and height.

Parameters
leftInteger defining the left edge of the rectangle
topInteger defining the top edge of the rectangle
widthInteger defining the width of the rectangle
heightInteger defining the height of the rectangle

◆ DRect() [3/3]

def dectris.albula.DRect.DRect (   rect)

Copy constructor.

Parameters
rectConstruct rectangle from an existing DRect rect.

Member Function Documentation

◆ bottom()

def dectris.albula.DRect.bottom ( )

Same as top() + height()

Returns
y coordinate of the bottom side

◆ height()

def dectris.albula.DRect.height ( )
Returns
rectangle's height

◆ left()

def dectris.albula.DRect.left ( )
Returns
x coordinate of the left side

◆ move()

def dectris.albula.DRect.move (   dx,
  dy 
)

move the rectangle by dx, dy holding width() and height() constant.

Parameters
dxmove in x direction by dx
dymove in y direction by dy

◆ right()

def dectris.albula.DRect.right ( )

Same as left() + width()

Returns
x coordinate of the right side

◆ setBottom()

def dectris.albula.DRect.setBottom (   y)

Sets the bottom edge of the rectangle to the given y-coordinate holding width() and height() constant.

Parameters
yy-coordinate of the bottom edge

◆ setHeight()

def dectris.albula.DRect.setHeight (   height)


Sets the rectangle's height holding top() constant.

Parameters
heightheight of the rectangle

◆ setLeft()

def dectris.albula.DRect.setLeft (   x)

Sets the left edge of the rectangle to the given x coordinate holding width() and height() constant.

Parameters
xx-coordinate of the left edge

◆ setRight()

def dectris.albula.DRect.setRight (   x)

Sets the right edge of the rectangle to the given x coordinate holding width() and height() constant.

Parameters
xx-coordinate of the right edge

◆ setTop()

def dectris.albula.DRect.setTop (   y)

Sets the top edge of the rectangle to the given y-coordinate holding width() and height() constant.

Parameters
yy-coordinate of the top edge

◆ setWidth()

def dectris.albula.DRect.setWidth (   width)


Sets the rectangle's width holding left() constant.

Parameters
widthwidth of the rectangle

◆ top()

def dectris.albula.DRect.top ( )
Returns
y coordinate of the top side

◆ width()

def dectris.albula.DRect.width ( )
Returns
rectangle's width