## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csPoly2DEdges Class Reference
[Geometry utilities]

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

`#include <csgeom/polyedge.h>`

List of all members.

## Public Member Functions

int | AddEdge (const csVector2 &v1, const csVector2 &v2)
| Add a edge (2D) to the polygon.
int | AddEdge (const csSegment2 &e)
| Add a edge (2D) to the polygon.
| csPoly2DEdges (csPoly2DEdges &copy)
| Copy constructor.
| csPoly2DEdges (int start_size=10)
| Make a new empty polygon.
csSegment2 * | GetEdge (int i)
| Get the specified edge.
int | GetEdgeCount ()
| Get the number of edges.
csSegment2 * | GetEdges ()
| Get the array with all edges.
csSegment2 * | GetFirst ()
| Get the first edge.
csSegment2 * | GetLast ()
| Get the last edge.
bool | In (const csVector2 &v)
| Test if this vector is inside the polygon.
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.
void | MakeEmpty ()
| Initialize the polygon to empty.
void | MakeRoom (int new_max)
| Make room for at least the specified number of edges.
csSegment2 & | operator[] (int i)
| Get the specified edge.
void | SetEdgeCount (int n)
| Set the number of edges.
virtual | ~csPoly2DEdges ()
| Destructor.

## Static Public Member Functions

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

## Protected Attributes

csSegment2 * | edges
| The edges.
int | max_edges
int | num_edges

## Detailed Description

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

Definition at line 38 of file polyedge.h.

## Constructor & Destructor Documentation

csPoly2DEdges::csPoly2DEdges | ( | int | start_size = `10` | ) |

| Make a new empty polygon.

csPoly2DEdges::csPoly2DEdges | ( | csPoly2DEdges & | copy | ) |

| Copy constructor.

virtual csPoly2DEdges::~csPoly2DEdges | ( |  | ) | `[virtual]`

| Destructor.

## 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. Definition at line 129 of file polyedge.h. References csSegment2::End(), and csSegment2::Start().

csSegment2* csPoly2DEdges::GetEdge | ( | int | i | ) | `[inline]`

| Get the specified edge. Definition at line 78 of file polyedge.h.

int csPoly2DEdges::GetEdgeCount | ( |  | ) | `[inline]`

| Get the number of edges. Definition at line 68 of file polyedge.h.

csSegment2* csPoly2DEdges::GetEdges | ( |  | ) | `[inline]`

| Get the array with all edges. Definition at line 73 of file polyedge.h.

csSegment2* csPoly2DEdges::GetFirst | ( |  | ) | `[inline]`

| Get the first edge. Definition at line 96 of file polyedge.h.

csSegment2* csPoly2DEdges::GetLast | ( |  | ) | `[inline]`

| Get the last edge. Definition at line 102 of file polyedge.h.

static bool csPoly2DEdges::In | ( | csSegment2 * | poly,
|  | int | num_edge,
|  | const csVector2 & | v
| ) | `[static]`

| Test if a vector is inside the given polygon.

bool csPoly2DEdges::In | ( | const csVector2 & | v | ) |

| Test if this vector is inside the polygon.

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.

void csPoly2DEdges::MakeEmpty | ( |  | ) |

| Initialize the polygon to empty.

void csPoly2DEdges::MakeRoom | ( | int | new_max | ) |

| Make room for at least the specified number of edges.

csSegment2& csPoly2DEdges::operator[] | ( | int | i | ) | `[inline]`

| Get the specified edge. Definition at line 87 of file polyedge.h. References CS_ASSERT.

void csPoly2DEdges::SetEdgeCount | ( | int | n | ) | `[inline]`

| Set the number of edges. Definition at line 123 of file polyedge.h.

## Member Data Documentation

csSegment2* csPoly2DEdges::edges `[protected]`

| The edges. Definition at line 42 of file polyedge.h.

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

- csgeom/polyedge.h