vtdata library
Public Member Functions | Public Attributes | List of all members
DRECT Class Reference

Public Member Functions

 DRECT (double l, double t, double r, double b)
 
 DRECT (const DPoint2 &leftTop, const DPoint2 &rightBottom)
 
void SetRect (double l, double t, double r, double b)
 
void SetInsideOut ()
 Set the rectangle to the maximum inverted values, e.g. to prepare to gather extents.
 
double Width () const
 
double Height () const
 
bool IsNull () const
 
bool IsEmpty () const
 
void SetToZero ()
 
void Sort ()
 
void GetCenter (DPoint2 &p) const
 
DPoint2 GetCenter () const
 
DPoint2 SizeExtents () const
 
DPoint2 LowerLeft () const
 
bool ContainsPoint (const DPoint2 &p, bool bInclusive=false) const
 
bool ContainsPoint (const DPoint3 &p) const
 
bool ContainsLine (const DLine2 &line) const
 
bool ContainsLine (const DLine3 &line) const
 
bool ContainsRect (const DRECT &r2) const
 
bool OverlapsRect (const DRECT &r2) const
 
void Offset (const DPoint2 &delta)
 
void Grow (double x, double y)
 
void GrowToContainPoint (const DPoint2 &p)
 
void GrowToContainLine (const DLine2 &line)
 
void GrowToContainLine (const DLine3 &line)
 
void GrowToContainRect (const DRECT &r2)
 
bool operator== (const DRECT &v) const
 
bool operator!= (const DRECT &v) const
 

Public Attributes

double left
 
double top
 
double right
 
double bottom
 

Detailed Description

DRECT / FRECT

These rectangle classes are meant to be used for geographical areas, or texture coordinates, which assume that the vertical axis increases upward, not like typical screen coordinates which increase downwards.

This means that the Height() method returns top-bottom, not bottom-top as would be the case with downward-increasing coordinates.

Member Function Documentation

bool DRECT::ContainsLine ( const DLine2 line) const

Fast, naive test for polyline/polygon inside rectangle.

Returns
true if any point of the poly is inside the rectangle.