DPolygon2 Class Reference

List of all members.

Public Member Functions

unsigned int NumTotalVertices () const
bool ComputeExtents (DRECT &rect) const
bool ContainsPoint (const DPoint2 &p) const
void GetAsDLine2 (DLine2 &dline) const
int WhichRing (int &iVtxNum) const
void NearestPoint (const DPoint2 &Point, int &iIndex, double &dist) const
bool NearestSegment (const DPoint2 &Point, int &iIndex, double &dist, DPoint2 &Intersection) const
void Add (const DPoint2 &p)
void Mult (double factor)
void ReverseOrder ()
void InsertPointAfter (int iInsertAfter, const DPoint2 &Point)
void RemovePoint (int N)
int RemoveDegeneratePoints (double dEpsilon)

Detailed Description

We represent a polygon as a collection of closed rings, each of which is represented by a DLine2. The first DLine2 is the 'outside' ring, any subsequent DLine2 are 'inside' rings, which are holes.

In most usage, there should be a consistency in the vertex ordering: the 'outside' ring should be counter-clockwise, and the 'inside' ring(s) should be clockwise.


Member Function Documentation

void DPolygon2::Add const DPoint2 p  ) 
 

Add the given amount to all coordinates of the polygon. Spatially, this offsets the location of the polygon.

void DPolygon2::GetAsDLine2 DLine2 dline  )  const
 

Normally the polygon is stored as a series of rings. Sometimes it is necessary to access the polygon as a single array of points instead.

This method fills a provided DLine2 with all the points of all rings of the polygon.

void DPolygon2::InsertPointAfter int  iInsertAfter,
const DPoint2 Point
 

The insertion point can be on the outer ring, or any inner ring.

void DPolygon2::Mult double  factor  ) 
 

Multiplies (scales) all the coordinates of the polygon.

void DPolygon2::NearestPoint const DPoint2 Point,
int &  iIndex,
double &  dClosest
const
 

Return the nearest point (of the points which make up the line). This is not the same as the closest place on the line, which may lie between the defining points; use NearestSegment to find that.

Parameters:
Point The input point.
iIndex Index of the first point of the nearest line segment.
dClosest Distance from the DLine2 to the input point.

bool DPolygon2::NearestSegment const DPoint2 Point,
int &  iIndex,
double &  dist,
DPoint2 Intersection
const
 

Returns the location of the closest point on the polygon to a given point.

Parameters:
Point The input point.
iIndex Index of the first point of the nearest line segment.
dist Distance from the DPolygon2 to the input point.
Intersection The closest point on the DPolygon2.
Returns:
True if a closest point was found.

void DPolygon2::RemovePoint int  N  ) 
 

The Nth point can be on the outer ring, or any inner ring.


Generated on Tue Apr 22 10:10:59 2008 for vtdata library by  doxygen 1.4.5