Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

C2DPolyBase Class Reference

A class which forms the basis of a 2 dimensional area or shape such as a polygon. Contains a closed set of lines of some sort, based on the abstract class C2DLineBase. Lines can be of mixed type. More...

#include <2DPolyBase.h>

Inheritance diagram for C2DPolyBase:

C2DBase C2DPolyArc C2DPolygon List of all members.

Public Member Functions

 C2DPolyBase (void)
 Constructor.
 C2DPolyBase (const C2DPolyBase &Other)
 Constructor.
 ~C2DPolyBase (void)
 Destructor.
const C2DPolyBaseoperator= (const C2DPolyBase &Other)
 Assigment.
void Set (const C2DPolyBase &Other)
 Assigment.
void CreateDirect (C2DLineBaseSet &Lines)
 Creates directly from a set of lines by extracting them from the set provided.
void Create (const C2DLineBaseSet &Lines)
 Creates from the set of lines using copies.
bool Contains (const C2DPoint &pt) const
 True if the point is in the shape.
bool Contains (const C2DPolyBase &Other) const
 True if it entirely contains the other.
bool Contains (const C2DHoledPolyBase &Other) const
 True if it entirely contains the other.
bool Contains (const C2DLineBase &Line) const
 True if it entirely contains the line.
bool HasCrossingLines (void) const
 True if any of the lines cross.
double Distance (const C2DPoint &pt) const
 Distance of the point from the shape. Returns -ve if inside.
double Distance (const C2DLineBase &Line) const
 Distance to the line.
double Distance (const C2DPolyBase &Other, C2DPoint *ptOnThis=0, C2DPoint *ptOnOther=0) const
 Distance of the poly from the shape.
bool IsWithinDistance (const C2DPoint &pt, double dRange) const
 True if the point is with the range given to the shape or inside.
void GetBoundingRect (C2DRect &Rect) const
 Returns the bounding rectangle.
const C2DRectGetBoundingRect (void) const
 Returns the bournding rectangle.
const C2DLineBaseGetLine (unsigned int i) const
 Returns a pointer to the line, 0 if invalid. Cycliclly handles indexes over the max.
const C2DLineBaseSetGetLines (void) const
 Returns the line set.
const C2DRectGetLineRect (unsigned int i) const
 Returns a pointer to the line rect.
unsigned int GetLineRectCount (void) const
 number of line rectangles (should be the same as the number of lines!).
double GetPerimeter (void) const
 Calculates the perimeter.
void Clear (void)
 Clears all.
void Move (const C2DVector &vector)
 Moves the shape.
void RotateToRight (double dAng, const C2DPoint &Origin)
 Rotates the polygon to the right around the origin given.
void Grow (double dFactor, const C2DPoint &Origin)
 Grows the area around the origin.
void Reflect (const C2DPoint &point)
 Reflects the area about the point.
void Reflect (const C2DLine &Line)
 Reflects throught the line provided.
bool Crosses (const C2DPolyBase &Other) const
 True if it crosses the other.
bool Crosses (const C2DPolyBase &Other, C2DPointSet *IntersectionPts) const
 Intersection with another.
bool Crosses (const C2DLineBase &Line) const
 Intersection with a line base. Finds out what sort of line it is first.
bool Crosses (const C2DLineBase &Line, C2DPointSet *IntersectionPts) const
 True if it crosses the line. Provides the intersection points.
bool CrossesRay (const C2DLine &Ray, C2DPointSet *IntersectionPts) const
 True if it crosses the ray. Provides the intersection points.
bool Overlaps (const C2DPolyBase &Other) const
 True if this overlaps the other.
bool Overlaps (const C2DHoledPolyBase &Other) const
 True if this overlaps the other.
bool IsClosed (void) const
 True if it is a closed shape which it should be.
void SnapToGrid (void)
 Snap to the conceptual grid.
void GetNonOverlaps (const C2DPolyBase &Other, C2DHoledPolyBaseSet &Polygons, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the non-overlaps of this with another.
void GetUnion (const C2DPolyBase &Other, C2DHoledPolyBaseSet &Polygons, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the union of this with another.
void GetOverlaps (const C2DPolyBase &Other, C2DHoledPolyBaseSet &Polygons, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the overlaps of this with another.
void GetRoutes (C2DPointSet &IntPts, CIndexSet &IntIndexes, C2DLineBaseSetSet &Routes, bool bStartInside, bool bRoutesInside=true) const
 Returns the routes inside or outside the other polygon / holed polygon.
void GetBoolean (const C2DPolyBase &Other, C2DHoledPolyBaseSet &Polygons, bool bThisInside, bool bOtherInside, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Gets the boolean operation with the other. e.g. union / intersection.
void Project (const C2DLine &Line, CInterval &Interval) const
 Projection onto the line.
void Project (const C2DVector &Vector, CInterval &Interval) const
 Projection onto the vector.
void RandomPerturb (void)
 Moves this by a tiny random amount.

Static Public Member Functions

static void GetRoutes (const C2DPolyBase &Poly1, bool bP1RoutesInside, const C2DPolyBase &Poly2, bool bP2RoutesInside, C2DLineBaseSetSet &Routes1, C2DLineBaseSetSet &Routes2)
 Returns the Route collections for 2 polygons.
static void RoutesToPolygons (C2DPolyBaseSet &Polygons, C2DLineBaseSetSet &Routes)
 Given a set of routes, this function converts them all to created polygon.

Protected Member Functions

void MakeBoundingRect (void)
 Forms the bounding rectangle.
void MakeLineRects (void)
 Forms the bounding rectangle.
void ReverseDirection (void)
 Reverses the direction of the lines.

Protected Attributes

C2DLineBaseSet m_Lines
 The lines.
C2DRect m_BoundingRect
 The bounding rectangle.
C2DRectSet m_LineRects
 The LINE bounding rectangles.

Detailed Description

A class which forms the basis of a 2 dimensional area or shape such as a polygon. Contains a closed set of lines of some sort, based on the abstract class C2DLineBase. Lines can be of mixed type.

---------------------------------------------------------------------------


Constructor & Destructor Documentation

C2DPolyBase::C2DPolyBase void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DPolyBase::C2DPolyBase

---------------------------------------------------------------------------

C2DPolyBase::C2DPolyBase const C2DPolyBase Other  ) 
 

Constructor.

--------------------------------------------------------------------------
C2DPolyBase::C2DPolyBase

---------------------------------------------------------------------------

C2DPolyBase::~C2DPolyBase void   ) 
 

Destructor.

--------------------------------------------------------------------------
C2DPolyBase::~C2DPolyBase

---------------------------------------------------------------------------


Member Function Documentation

void C2DPolyBase::Clear void   ) 
 

Clears all.

--------------------------------------------------------------------------
C2DPolyBase::Clear

---------------------------------------------------------------------------

Reimplemented in C2DPolyArc, and C2DPolygon.

bool C2DPolyBase::Contains const C2DLineBase Line  )  const
 

True if it entirely contains the line.

--------------------------------------------------------------------------
C2DPolyBase::Contains

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

bool C2DPolyBase::Contains const C2DHoledPolyBase Other  )  const
 

True if it entirely contains the other.

--------------------------------------------------------------------------
C2DPolyBase::Contains

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

bool C2DPolyBase::Contains const C2DPolyBase Other  )  const
 

True if it entirely contains the other.

--------------------------------------------------------------------------
C2DPolyBase::Contains

---------------------------------------------------------------------------

bool C2DPolyBase::Contains const C2DPoint pt  )  const
 

True if the point is in the shape.

--------------------------------------------------------------------------
C2DPolyBase::Contains

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

void C2DPolyBase::Create const C2DLineBaseSet Lines  ) 
 

Creates from the set of lines using copies.

--------------------------------------------------------------------------
C2DPolyBase::Create

---------------------------------------------------------------------------

void C2DPolyBase::CreateDirect C2DLineBaseSet Lines  ) 
 

Creates directly from a set of lines by extracting them from the set provided.

--------------------------------------------------------------------------
C2DPolyBase::CreateDirect

---------------------------------------------------------------------------

bool C2DPolyBase::Crosses const C2DLineBase Line,
C2DPointSet IntersectionPts
const
 

True if it crosses the line. Provides the intersection points.

--------------------------------------------------------------------------
C2DPolyBase::Crosses

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

bool C2DPolyBase::Crosses const C2DLineBase Line  )  const
 

Intersection with a line base. Finds out what sort of line it is first.

--------------------------------------------------------------------------
C2DPolyBase::Crosses

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

bool C2DPolyBase::Crosses const C2DPolyBase Other,
C2DPointSet IntersectionPts
const
 

Intersection with another.

--------------------------------------------------------------------------
C2DPolyBase::Crosses

---------------------------------------------------------------------------

bool C2DPolyBase::Crosses const C2DPolyBase Other  )  const
 

True if it crosses the other.

--------------------------------------------------------------------------
C2DPolyBase::Crosses

---------------------------------------------------------------------------

bool C2DPolyBase::CrossesRay const C2DLine Line,
C2DPointSet IntersectionPts
const
 

True if it crosses the ray. Provides the intersection points.

--------------------------------------------------------------------------
C2DPolyBase::CrossesRay

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

double C2DPolyBase::Distance const C2DPolyBase Other,
C2DPoint ptOnThis = 0,
C2DPoint ptOnOther = 0
const
 

Distance of the poly from the shape.

--------------------------------------------------------------------------
C2DPolyBase::Distance

---------------------------------------------------------------------------

double C2DPolyBase::Distance const C2DLineBase Line  )  const
 

Distance to the line.

--------------------------------------------------------------------------
C2DPolyBase::Distance

---------------------------------------------------------------------------

double C2DPolyBase::Distance const C2DPoint pt  )  const [virtual]
 

Distance of the point from the shape. Returns -ve if inside.

--------------------------------------------------------------------------
C2DPolyBase::Distance

---------------------------------------------------------------------------

Implements C2DBase.

void C2DPolyBase::GetBoolean const C2DPolyBase Other,
C2DHoledPolyBaseSet HoledPolys,
bool  bThisInside,
bool  bOtherInside,
CGrid::eDegenerateHandling  eDegen = CGrid::None
const
 

Gets the boolean operation with the other. e.g. union / intersection.

--------------------------------------------------------------------------
C2DPolyBase::GetBoolean

---------------------------------------------------------------------------

const C2DLineBase * C2DPolyBase::GetLine unsigned int  i  )  const
 

Returns a pointer to the line, 0 if invalid. Cycliclly handles indexes over the max.

--------------------------------------------------------------------------
C2DPolyBase::GetLine

---------------------------------------------------------------------------

Reimplemented in C2DPolygon.

const C2DRect * C2DPolyBase::GetLineRect unsigned int  i  )  const
 

Returns a pointer to the line rect.

--------------------------------------------------------------------------
C2DPolyBase::GetLineRect

---------------------------------------------------------------------------

void C2DPolyBase::GetNonOverlaps const C2DPolyBase Other,
C2DHoledPolyBaseSet Polygons,
CGrid::eDegenerateHandling  eDegen = CGrid::None
const
 

Returns the non-overlaps of this with another.

--------------------------------------------------------------------------
C2DPolyBase::GetNonOverlaps

---------------------------------------------------------------------------

void C2DPolyBase::GetOverlaps const C2DPolyBase Other,
C2DHoledPolyBaseSet Polygons,
CGrid::eDegenerateHandling  eDegen = CGrid::None
const
 

Returns the overlaps of this with another.

--------------------------------------------------------------------------
C2DPolyBase::GetOverlaps

---------------------------------------------------------------------------

double C2DPolyBase::GetPerimeter void   )  const
 

Calculates the perimeter.

--------------------------------------------------------------------------
C2DPolyBase::GetPerimeter

---------------------------------------------------------------------------

void C2DPolyBase::GetRoutes const C2DPolyBase Poly1,
bool  bP1RoutesInside,
const C2DPolyBase Poly2,
bool  bP2RoutesInside,
C2DLineBaseSetSet Routes1,
C2DLineBaseSetSet Routes2
[static]
 

Returns the Route collections for 2 polygons.

--------------------------------------------------------------------------
C2DPolyBase::GetRoutes<BR>

---------------------------------------------------------------------------

void C2DPolyBase::GetRoutes C2DPointSet IntPts,
CIndexSet IntIndexes,
C2DLineBaseSetSet Routes,
bool  bStartInside,
bool  bRoutesInside = true
const
 

Returns the routes inside or outside the other polygon / holed polygon.

Returns the routes (collection of lines and sublines) either inside or outside another Given the intersection points.

void C2DPolyBase::GetUnion const C2DPolyBase Other,
C2DHoledPolyBaseSet Polygons,
CGrid::eDegenerateHandling  eDegen = CGrid::None
const
 

Returns the union of this with another.

--------------------------------------------------------------------------
C2DPolyBase::GetUnion

---------------------------------------------------------------------------

void C2DPolyBase::Grow double  dFactor,
const C2DPoint Origin
[virtual]
 

Grows the area around the origin.

--------------------------------------------------------------------------
C2DPolyBase::Grow

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

bool C2DPolyBase::HasCrossingLines void   )  const
 

True if any of the lines cross.

--------------------------------------------------------------------------
C2DPolyBase::HasCrossingLines

---------------------------------------------------------------------------

bool C2DPolyBase::IsClosed void   )  const
 

True if it is a closed shape which it should be.

--------------------------------------------------------------------------
C2DPolyBase::IsClosed

---------------------------------------------------------------------------

bool C2DPolyBase::IsWithinDistance const C2DPoint pt,
double  dRange
const
 

True if the point is with the range given to the shape or inside.

--------------------------------------------------------------------------
C2DPolyBase::IsWithinDistance

---------------------------------------------------------------------------

void C2DPolyBase::MakeBoundingRect void   )  [protected]
 

Forms the bounding rectangle.

--------------------------------------------------------------------------
C2DPolyBase::MakeBoundingRect

---------------------------------------------------------------------------

void C2DPolyBase::MakeLineRects void   )  [protected]
 

Forms the bounding rectangle.

--------------------------------------------------------------------------
C2DPolyBase::MakeLineRects

---------------------------------------------------------------------------

void C2DPolyBase::Move const C2DVector vector  )  [virtual]
 

Moves the shape.

--------------------------------------------------------------------------
C2DPolyBase::Move

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

const C2DPolyBase & C2DPolyBase::operator= const C2DPolyBase Other  ) 
 

Assigment.

--------------------------------------------------------------------------
C2DPolyBase::operator=

---------------------------------------------------------------------------

bool C2DPolyBase::Overlaps const C2DPolyBase Other  )  const
 

True if this overlaps the other.

--------------------------------------------------------------------------
C2DPolyBase::Overlaps

---------------------------------------------------------------------------

void C2DPolyBase::Project const C2DVector Vector,
CInterval Interval
const [virtual]
 

Projection onto the vector.

--------------------------------------------------------------------------
C2DPolyBase::Project

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

void C2DPolyBase::Project const C2DLine Line,
CInterval Interval
const [virtual]
 

Projection onto the line.

--------------------------------------------------------------------------
C2DPolyBase::Project

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

void C2DPolyBase::RandomPerturb void   ) 
 

Moves this by a tiny random amount.

--------------------------------------------------------------------------
C2DPolyBase::RandomPerturb

---------------------------------------------------------------------------

void C2DPolyBase::Reflect const C2DLine Line  )  [virtual]
 

Reflects throught the line provided.

--------------------------------------------------------------------------
C2DPolyBase::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

void C2DPolyBase::Reflect const C2DPoint point  )  [virtual]
 

Reflects the area about the point.

--------------------------------------------------------------------------
C2DPolyBase::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolygon.

void C2DPolyBase::ReverseDirection void   )  [protected]
 

Reverses the direction of the lines.

--------------------------------------------------------------------------
C2DPolyBase::ReverseDirection

---------------------------------------------------------------------------

void C2DPolyBase::RotateToRight double  dAng,
const C2DPoint Origin
[virtual]
 

Rotates the polygon to the right around the origin given.

--------------------------------------------------------------------------
C2DPolyBase::RotateToRight

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DPolyArc, and C2DPolygon.

void C2DPolyBase::RoutesToPolygons C2DPolyBaseSet Polygons,
C2DLineBaseSetSet Routes
[static]
 

Given a set of routes, this function converts them all to created polygon.

--------------------------------------------------------------------------
C2DPolyBase::RoutesToPolygons

---------------------------------------------------------------------------

void C2DPolyBase::Set const C2DPolyBase Other  ) 
 

Assigment.

--------------------------------------------------------------------------
C2DPolyBase::Set

---------------------------------------------------------------------------

void C2DPolyBase::SnapToGrid void   )  [virtual]
 

Snap to the conceptual grid.

--------------------------------------------------------------------------
C2DPolyBase::SnapToGrid

---------------------------------------------------------------------------

Implements C2DBase.


The documentation for this class was generated from the following files:
Generated on Mon Apr 21 11:43:52 2008 for GeoLib by  doxygen 1.4.4