## Public API Reference

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

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

# csPolygonClipper Class Reference
[Geometry utilities]

The csPolygonClipper class can be used for clipping any polygon against any other convex polygon. More...

`#include <csgeom/polyclip.h>`

Inheritance diagram for csPolygonClipper:

[legend]
List of all members.

## Public Member Functions

virtual int | ClassifyBox (const csBox2 &box)
| Classify some bounding box against this clipper.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount, csVertexStatus *OutStatus)
| Clip and return additional information about each vertex.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount, csBox2 &BoundingBox)
| Clip and compute the bounding box.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount)
| Simple clipping.
| csPolygonClipper (csVector2 *Clipper, size_t Count, bool mirror=false, bool copy=false)
| Create a polygon clipper object from a set of 2D vectors.
| csPolygonClipper (csPoly2D *Clipper, bool mirror=false, bool copy=false)
| Create a polygon clipper object from a 2D polygon.
virtual ClipperType | GetClipperType () const
| Retrieve the type of this clipper.
virtual csVector2 * | GetClipPoly ()
| Return a pointer to the array of csVector2's.
virtual size_t | GetVertexCount ()
| Return number of vertices for this clipper polygon.
virtual bool | IsInside (const csVector2 &v)
| Return true if given point is inside (or on bound) of clipper polygon.
virtual | ~csPolygonClipper ()
| Destroy the polygon clipper object.

## Detailed Description

The csPolygonClipper class can be used for clipping any polygon against any other convex polygon.

The clipper object should be used, if possible, for many polygons (for example, a 3D sprite can initialize a clipper object then clip all of its triangle against it at once) as the initialization of clipper polygon involves some (although not too expensive) calculations. The clipping polygon *should* be convex since the routine does not expect any line to intersect the edge of clipping polygon more than twice.

Definition at line 142 of file polyclip.h.

## Constructor & Destructor Documentation

csPolygonClipper::csPolygonClipper | ( | csPoly2D * | Clipper,
|  | bool | mirror = `false`,
|  | bool | copy = `false`
| ) |

| Create a polygon clipper object from a 2D polygon.

csPolygonClipper::csPolygonClipper | ( | csVector2 * | Clipper,
|  | size_t | Count,
|  | bool | mirror = `false`,
|  | bool | copy = `false`
| ) |

| Create a polygon clipper object from a set of 2D vectors.

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

| Destroy the polygon clipper object.

## Member Function Documentation

virtual int csPolygonClipper::ClassifyBox | ( | const csBox2 & | box | ) | `[virtual]`

| Classify some bounding box against this clipper. Implements iClipper2D.

virtual uint8 csPolygonClipper::Clip | ( | csVector2 * | InPolygon,
|  | size_t | InCount,
|  | csVector2 * | OutPolygon,
|  | size_t & | OutCount,
|  | csVertexStatus * | OutStatus
| ) | `[virtual]`

| Clip and return additional information about each vertex. Implements iClipper2D.

virtual uint8 csPolygonClipper::Clip | ( | csVector2 * | InPolygon,
|  | size_t | InCount,
|  | csVector2 * | OutPolygon,
|  | size_t & | OutCount,
|  | csBox2 & | BoundingBox
| ) | `[virtual]`

| Clip and compute the bounding box. Implements iClipper2D.

virtual uint8 csPolygonClipper::Clip | ( | csVector2 * | InPolygon,
|  | size_t | InCount,
|  | csVector2 * | OutPolygon,
|  | size_t & | OutCount
| ) | `[virtual]`

| Simple clipping. Implements iClipper2D.

virtual ClipperType csPolygonClipper::GetClipperType | ( |  | ) | const`[inline, virtual]`

| Retrieve the type of this clipper. Implements iClipper2D. Definition at line 193 of file polyclip.h.

virtual csVector2* csPolygonClipper::GetClipPoly | ( |  | ) | `[inline, virtual]`

| Return a pointer to the array of csVector2's. Implements iClipper2D. Definition at line 190 of file polyclip.h.

virtual size_t csPolygonClipper::GetVertexCount | ( |  | ) | `[inline, virtual]`

| Return number of vertices for this clipper polygon. Implements iClipper2D. Definition at line 187 of file polyclip.h.

virtual bool csPolygonClipper::IsInside | ( | const csVector2 & | v | ) | `[virtual]`

| Return true if given point is inside (or on bound) of clipper polygon. Implements iClipper2D.

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

- csgeom/polyclip.h