## Public API Reference

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

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

# iClipper2D Struct Reference
[Geometry utilities]

This interfaces represents a 2D clipper for polygons. More...

`#include <igeom/clip2d.h>`

Inheritance diagram for iClipper2D:

[legend]
List of all members.

## Public Types

enum | ClipperType { clipperPoly, clipperBox }
| The type of a clipper. More...

## Public Member Functions

virtual int | ClassifyBox (const csBox2 &box)=0
| Classify some bounding box against this clipper.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount, csVertexStatus *OutStatus)=0
| Clips a set of 2D points and provides additional information on each output vertex.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount, csBox2 &BoundingBox)=0
| Clip a set of 2D points.
virtual uint8 | Clip (csVector2 *InPolygon, size_t InCount, csVector2 *OutPolygon, size_t &OutCount)=0
| Clip a set of 2D points and return in 'OutPolygon' which is expected to contain space at least for MAX_OUTPUT_VERTICES elements.
virtual uint8 | ClipInPlace (csVector2 *InPolygon, size_t &InOutCount, csBox2 &BoundingBox)=0
| Wrapper function: clip a polygon in-place.
virtual ClipperType | GetClipperType () const =0
| Retrieve the type of this clipper.
virtual csVector2 * | GetClipPoly ()=0
| Return a pointer to the array of csVector2's.
virtual size_t | GetVertexCount ()=0
| Return number of vertices for this clipper polygon.
virtual bool | IsInside (const csVector2 &v)=0
| Return true if given point is inside (or on bound) of clipper polygon.

## Detailed Description

This interfaces represents a 2D clipper for polygons.

Definition at line 94 of file clip2d.h.

## Member Enumeration Documentation

enum iClipper2D::ClipperType

The type of a clipper.

Enumerator:

  clipperPoly | This clipper contains a polygon.
  clipperBox | This clipper contains a box. Can be used for some optimizations.

Definition at line 154 of file clip2d.h.

## Member Function Documentation

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

Classify some bounding box against this clipper.

This function returns:

- -1 if box is not visible.
- 0 if box is partially visible.
- 1 if box is entirely visible.

Implemented in csBoxClipper, and csPolygonClipper.

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

Clips a set of 2D points and provides additional information on each output vertex.

The information type can be: vertex is one of original vertices, vertex is on the edge of the original polygon and vertex is arbitrary located inside the original polygon. Both OutPolygon and OutStatus arrays are expected to have enough storage for at least MAX_OUTPUT_VERTICES elements.

Returns:
  One of CS_CLIP_*.

Implemented in csBoxClipper, and csPolygonClipper.

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

Clip a set of 2D points.

On output OutCount is set to number of vertices in output polygon. The output array is expected to contain space for at least MAX_OUTPUT_VERTICES elements. The bounding box is set to the minimal rectangle that contains the output polygon.

Returns:
  One of CS_CLIP_*.

Implemented in csBoxClipper, and csPolygonClipper.

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

Clip a set of 2D points and return in 'OutPolygon' which is expected to contain space at least for MAX_OUTPUT_VERTICES elements.

Returns:
  One of CS_CLIP_*.

Implemented in csBoxClipper, and csPolygonClipper.

virtual uint8 iClipper2D::ClipInPlace | ( | csVector2 * | InPolygon,
|  | size_t & | InOutCount,
|  | csBox2 & | BoundingBox
| ) | `[pure virtual]`

Wrapper function: clip a polygon in-place.

Returns:
  One of CS_CLIP_*.

Implemented in csClipper.

virtual ClipperType iClipper2D::GetClipperType | ( |  | ) | const`[pure virtual]`

| Retrieve the type of this clipper. Implemented in csBoxClipper, and csPolygonClipper.

virtual csVector2* iClipper2D::GetClipPoly | ( |  | ) | `[pure virtual]`

| Return a pointer to the array of csVector2's. Implemented in csBoxClipper, and csPolygonClipper.

virtual size_t iClipper2D::GetVertexCount | ( |  | ) | `[pure virtual]`

| Return number of vertices for this clipper polygon. Implemented in csBoxClipper, and csPolygonClipper.

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

| Return true if given point is inside (or on bound) of clipper polygon. Implemented in csBoxClipper, and csPolygonClipper.

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

- igeom/clip2d.h