Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csPoly2DEdges Class Reference

The following class represents a general 2D polygon represented with edges instead of vertices. More...

#include <polyedge.h>

List of all members.

Public Methods

 csPoly2DEdges (int start_size=10)
 Make a new empty polygon.

 csPoly2DEdges (csPoly2DEdges &copy)
 Copy constructor.

virtual ~csPoly2DEdges ()
 Destructor.

void MakeEmpty ()
 Initialize the polygon to empty.

int GetEdgeCount ()
 Get the number of edges.

csSegment2GetEdges ()
 Get the array with all edges.

csSegment2GetEdge (int i)
 Get the specified edge.

csSegment2operator[] (int i)
 Get the specified edge.

csSegment2GetFirst ()
 Get the first edge.

csSegment2GetLast ()
 Get the last edge.

bool In (const csVector2 &v)
 Test if this vector is inside the polygon.

void MakeRoom (int new_max)
 Make room for at least the specified number of edges.

void SetEdgeCount (int n)
 Set the number of edges.

int AddEdge (const csSegment2 &e)
 Add a edge (2D) to the polygon. More...

int AddEdge (const csVector2 &v1, const csVector2 &v2)
 Add a edge (2D) to the polygon. More...

void Intersect (const csPlane2 &plane, csPoly2DEdges &left, csPoly2DEdges &right, bool &onplane) const
 Intersect this polygon with a given plane and return the two resulting polygons in left and right. More...


Static Public Methods

bool In (csSegment2 *poly, int num_edge, const csVector2 &v)
 Test if a vector is inside the given polygon.


Protected Attributes

csSegment2edges
 The edges.

int num_edges
int max_edges


Detailed Description

The following class represents a general 2D polygon represented with edges instead of vertices.


Member Function Documentation

int csPoly2DEdges::AddEdge ( const csVector2 & v1,
const csVector2 & v2 )
 

Add a edge (2D) to the polygon.

Return index of added edge.

int csPoly2DEdges::AddEdge ( const csSegment2 & e ) [inline]
 

Add a edge (2D) to the polygon.

Return index of added edge.

void csPoly2DEdges::Intersect ( const csPlane2 & plane,
csPoly2DEdges & left,
csPoly2DEdges & right,
bool & onplane ) const
 

Intersect this polygon with a given plane and return the two resulting polygons in left and right.

This version is robust. If one of the edges of this polygon happens to be on the same plane as 'plane' then this edge will be ignored and 'onplane' will be set to true.

Note that this routine may result in unconnected polygons. i.e. edges that are not adjacent.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000