In file include/csgeom/polyclip.h:

class csPolygonClipper : public csClipper

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

Inheritance:


Public Methods

virtual bool Clip(csVector2 *Polygon, int &Count, int MaxCount, csBox *BoundingBox)
Clip a set of 2D points and return them in the same array
virtual bool Clip(csVector2 *Polygon, csVector2* dest_poly, int Count, int &OutCount)
Clip to dest_poly.
csPolygonClipper(csPoly2D *Clipper, bool mirror = false, bool copy = false)
Create a polygon clipper object from a set of 2D vectors.
virtual int GetNumVertices()
Return number of vertices for this clipper polygon.
virtual const csVector2 GetVertex(int i)
Return vertex at index for this clipper polygon.
virtual bool IsInside(float x, float y)
Return true if given point is inside (or on bound) of clipper polygon.
virtual ~csPolygonClipper()
Destroy the polygon clipper object.

Private Fields

csBox ClipBox
Clipping polygon bounding box
SegData* ClipData
Equation for all edges of clipping polygon
csVector2* ClipPoly
Clipper polygon itself
csPoly2D* ClipPoly2D
A pointer to the pooled polygon (so that we can free it later).
int ClipPolyVertices
Number of vertices in clipper polygon

Private

struct SegData
Private structure for keeping pre-calculated some data

Inherited from csClipper:

Protected Fields

static csPoly2DPool polypool

Documentation

The csPolygonClipper class can be used for clipping any convex polygon with any other 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. Both clipped and clipping polygons *should* be convex as the result of intersection of two non-convex polygons can result in more than one resulting polygon, and this class does not handle that.
struct SegData
Private structure for keeping pre-calculated some data

SegData* ClipData
Equation for all edges of clipping polygon

csVector2* ClipPoly
Clipper polygon itself

csPoly2D* ClipPoly2D
A pointer to the pooled polygon (so that we can free it later).

int ClipPolyVertices
Number of vertices in clipper polygon

csBox ClipBox
Clipping polygon bounding box

csPolygonClipper(csPoly2D *Clipper, bool mirror = false, bool copy = false)
Create a polygon clipper object from a set of 2D vectors.

virtual ~csPolygonClipper()
Destroy the polygon clipper object.

virtual bool Clip(csVector2 *Polygon, csVector2* dest_poly, int Count, int &OutCount)
Clip to dest_poly.

virtual bool Clip(csVector2 *Polygon, int &Count, int MaxCount, csBox *BoundingBox)
Clip a set of 2D points and return them in the same array. On input MaxCount contains number of elements that Output can hold. On output Count is set to number of vertices in output polygon.

virtual bool IsInside(float x, float y)
Return true if given point is inside (or on bound) of clipper polygon.

virtual int GetNumVertices()
Return number of vertices for this clipper polygon.

virtual const csVector2 GetVertex(int i)
Return vertex at index for this clipper polygon.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de