vtdata library

Inherits DLine2Array.
Public Member Functions  
uint  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) 
int  RemoveColinearPoints (double dEpsilon) 
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 counterclockwise, and the 'inside' ring(s) should be clockwise.
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.
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.
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. 
int DPolygon2::RemoveColinearPoints  (  double  dEpsilon  ) 
For each ring of the polygon, remove any points which are colinear, defined as point p(n) which is less than dEpsilon displaced from the line from P(n1) to P(n+1)
int DPolygon2::RemoveDegeneratePoints  (  double  dEpsilon  ) 
For each ring of the polygon, remove any points which are degenerate (less than dEpsilon apart).
void DPolygon2::RemovePoint  (  int  N  ) 
The Nth point can be on the outer ring, or any inner ring.