DLine2 Class Reference

Inheritance diagram for DLine2:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 DLine2 (int size)
 DLine2 (const DLine2 &ref)
DLine2operator= (const DLine2 &v)
DLine2operator= (const FLine2 &v)
void Add (const DPoint2 &p)
 Add a given offset to all points.
void Mult (double factor)
 Multiply all points by a given factor.
void InsertPointAfter (int iInsertAfter, const DPoint2 &Point)
void RemovePoint (int i)
void ReverseOrder ()
int RemoveDegeneratePoints (double dEpsilon)
bool ContainsPoint (const DPoint2 &p) const
double SegmentLength (unsigned int i) const
void NearestPoint (const DPoint2 &Point, int &iIndex, double &dist) const
bool NearestSegment (const DPoint2 &Point, int &iIndex, double &dist, DPoint2 &Intersection) const
bool IsConvex () const
DPoint2GetSafePoint (int index) const
void SetSafePoint (int index, const DPoint2 &p)
double Length () const
DPoint2 Centroid () const
double Area () const

Detailed Description

A series of 2D points. This is useful for representing either a series of points, line segments or a simple closed polygon. Double-precision.


Member Function Documentation

bool DLine2::ContainsPoint const DPoint2 p  )  const
 

With the assumption that this set of points defines a closed polygon, test whether the polygon contains a given point. Since a simple array of points being interpreted as a polygon, this means the data may be concave or convex, but not contains holes.

DPoint2 & DLine2::GetSafePoint int  index  )  const
 

Get a point on the line, safely wrapping around to the end or beginning for index values that are out of range.

void DLine2::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 DLine2::NearestSegment const DPoint2 Point,
int &  iIndex,
double &  dist,
DPoint2 Intersection
const
 

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

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

int DLine2::RemoveDegeneratePoints double  dEpsilon  ) 
 

Given four points A B C D, where B and C are identical, then this line is a triangle not a rectangle. Remove the identical points to produce A B D. Points are identical if they are within dEpsilon of each other.

double DLine2::SegmentLength unsigned int  i  )  const
 

Return the length of the N'th segment in the line, which is the distance between points N and N+1. If the length of the last segment is requested, a closed polygon is assumed.


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