Marmot
Public Member Functions
Marmot::Common::Rect::Rect Class Reference

Rectangle class. More...

List of all members.

Public Member Functions

def __init__
def x0
def y0
def x1
def y1
def width
def height
def area
def isOverlap
def isInside
def distanceX
def distanceY
def __str__
def intersection
def union

Detailed Description

Rectangle class.

Remarks:
The origin of the coordinate system is at the left-bottom corner of page.
The unit of length is "pound", which is 1/72 inch.

Constructor & Destructor Documentation

def Marmot::Common::Rect::Rect::__init__ (   self,
  x0,
  y0,
  x1,
  y1 
)
Parameters:
x0the less of left and right
y0the less of top and bottm
x1the greater of left and right
y1the greater of top and bottom
Remarks:
If x0 is greater than x1, they are swapped to build the rect. So for the y's.

Member Function Documentation

def Marmot::Common::Rect::Rect::isOverlap (   self,
  rect 
)
Parameters:
rectthe other rectangle
Returns:
True if rect overlaps with this rect;
False elsewise.
def Marmot::Common::Rect::Rect::isInside (   self,
  rect 
)
Parameters:
rectthe other rectangle
Returns:
True if this rect is inside rect; False elsewise.
def Marmot::Common::Rect::Rect::distanceX (   self,
  rect 
)
Parameters:
rectthe other rectangle
Returns:
distance along x axis.
Remarks:
If the rects overlap along x axis, distanceX will return a negative value, whose abstract value indicates how much they overlap along x axis;
elsewise the distance is positive.
def Marmot::Common::Rect::Rect::distanceY (   self,
  rect 
)
Parameters:
rectthe other rectangle
Returns:
distance along y axis.
Remarks:
Similar to distanceX except that the distance is along y axis.
def Marmot::Common::Rect::Rect::intersection (   lhs,
  rhs 
)
Parameters:
lhsone rectangle
rhsthe other rectangle
Returns:
intersection of two rectangles.
Remarks:
This is a static method.
Make sure lhs.isOverlap(rhs) returns True, or the returned rectangle is ill formed.
def Marmot::Common::Rect::Rect::union (   lhs,
  rhs 
)
Parameters:
lhsone rectangle
rhsthe other rectangle
Returns:
Union of two rectangles.
Remarks:
This is a static method.

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