Vault  4.1
Public Member Functions | Static Public Member Functions | Friends
VPolygonT< T > Class Template Reference

VPolygonT defines a polygon or series of points. More...

#include <vgeometry.h>

List of all members.

Public Member Functions

 VPolygonT (const std::vector< VPointT< T > > &points)
 VPolygonT (VBinaryIOStream &stream)
 VPolygonT (const VRectT< T > &rect)
void readFromStream (VBinaryIOStream &stream)
void writeToStream (VBinaryIOStream &stream) const
void add (VPointT< T > p)
void insert (int beforeIndex, VPointT< T > p)
int getNumPoints () const
size_t size () const
const std::vector< VPointT< T > > & getPoints () const
VPointT< T > getPoint (int index) const
void setPoint (int index, VPointT< T > p)
VPointT< T > & operator[] (int index)
VPointT< T > operator[] (int index) const
VRectT< T > getBounds () const
void remove (int index)
void eraseAll ()
void translate (VPointT< T > offset)
VLineT< T > getSide (int index) const
int getNearestVertex (const VPointT< T > &testPoint) const
 Returns the index of the vertex of the polygon nearest to the supplied point.
int getNearestSide (const VPointT< T > &testPoint) const
 Returns the index of the side of the polygon that is nearest to the supplied point.
int getNearestSide (const VPointT< T > &testPoint, VPoint &nearestPoint) const
 Returns the index of the side of the polygon that is nearest to the supplied point.

Static Public Member Functions

static bool equal (const VPolygonT< T > &p1, const VPolygonT< T > &p2)
static bool notEqual (const VPolygonT< T > &p1, const VPolygonT< T > &p2)

Friends

bool operator== (const VPolygonT< T > &p1, const VPolygonT< T > &p2)
bool operator!= (const VPolygonT< T > &p1, const VPolygonT< T > &p2)

Detailed Description

template<typename T>
class VPolygonT< T >

VPolygonT defines a polygon or series of points.

VPolygon uses VDouble coordinates; VIPolygon uses int coordinates.

Definition at line 710 of file vgeometry.h.


Member Function Documentation

template<typename T>
int VPolygonT< T >::getNearestVertex ( const VPointT< T > &  testPoint) const [inline]

Returns the index of the vertex of the polygon nearest to the supplied point.

Parameters:
testPointa point to test proximity
Returns:
the vertex nearest to the test point

Definition at line 808 of file vgeometry.h.

template<typename T>
int VPolygonT< T >::getNearestSide ( const VPointT< T > &  testPoint) const [inline]

Returns the index of the side of the polygon that is nearest to the supplied point.

If the test point is in a "dead zone" where the nearest point on a side is a vertex, there is currently no guarantee which of the two candidate sides will be returned.

Parameters:
testPointa point to test proximity
Returns:
the index of the side of the polygon the point is nearest to
See also:
"dead zone" comments at the end of this file

Definition at line 831 of file vgeometry.h.

template<typename T>
int VPolygonT< T >::getNearestSide ( const VPointT< T > &  testPoint,
VPoint nearestPoint 
) const [inline]

Returns the index of the side of the polygon that is nearest to the supplied point.

If the test point is in a "dead zone" where the nearest point on a side is a vertex, there is currently no guarantee which of the two candidate sides will be returned, and the returned nearestPoint will a vertex (shared by the two possible sides).

Parameters:
testPointa point to test proximity
nearestPointreturned value, the point (on the side) that is nearest to the test point
Returns:
the index of the side of the polygon the point is nearest to
See also:
"dead zone" comments at the end of this file

Definition at line 847 of file vgeometry.h.


The documentation for this class was generated from the following file:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.