SubPolygon Class Reference

A class for handling sub-polygons. Each sub-polygon is a continuos, closed set of edges. More...

#include <SubPolygon.h>

List of all members.

Public Member Functions

 SubPolygon (VECTOR2D *aVertices, int aVertexCount)
 Constructor.
bool init ()
 Initializer.
 ~SubPolygon ()
 Destructor.
int getVertexCount () const
 Returns the amount of vertices in the polygon.
const VECTOR2D & getVertex (int aIndex) const
 Returns a vertex at given position.
int getEdges (int aFirstVertex, int aVertexCount, PolygonEdge *aEdges, const MATRIX2D &aTransformation, const ClipRectangle &aClipRectangle) const
 Calculates the edges of the polygon with transformation and clipping to aEdges array.
int getScanEdges (PolygonScanEdge *aEdges, const MATRIX2D &aTransformation, const ClipRectangle &aClipRectangle) const
 Calculates the edges of the polygon with transformation and clipping to aEdges array.

Protected Member Functions

int getClipFlags (const VECTOR2D &aPoint, const ClipRectangle &aClipRectangle) const
 Calculates the clip flags for a point.
bool getEdge (const VECTOR2D &aStart, const VECTOR2D &aEnd, PolygonEdge &aEdge, const ClipRectangle &aClipRectangle) const
 Creates a polygon edge between two vectors.
bool getVerticalEdge (RATIONAL aStartY, RATIONAL aEndY, RATIONAL aX, PolygonEdge &aEdge, const ClipRectangle &aClipRectangle) const
 Creates a vertical polygon edge between two y values.
int getScanEdge (VertexData *aVertexData, short aWinding, PolygonScanEdge *aEdges, const ClipRectangle &aClipRectangle) const
 Returns the edge(s) between two vertices in aVertexData.

Protected Attributes

int mVertexCount
VECTOR2D * mVertices
VertexDatamVertexData


Detailed Description

A class for handling sub-polygons. Each sub-polygon is a continuos, closed set of edges.


Constructor & Destructor Documentation

SubPolygon::SubPolygon VECTOR2D *  aVertices,
int  aVertexCount
 

Constructor.

Note that the ownership of the vertex array is transferred.

SubPolygon::~SubPolygon  ) 
 

Destructor.


Member Function Documentation

int SubPolygon::getClipFlags const VECTOR2D &  aPoint,
const ClipRectangle aClipRectangle
const [inline, protected]
 

Calculates the clip flags for a point.

bool SubPolygon::getEdge const VECTOR2D &  aStart,
const VECTOR2D &  aEnd,
PolygonEdge aEdge,
const ClipRectangle aClipRectangle
const [protected]
 

Creates a polygon edge between two vectors.

Clips the edge vertically to the clip rectangle. Returns true for edges that should be rendered, false for others.

int SubPolygon::getEdges int  aFirstVertex,
int  aVertexCount,
PolygonEdge aEdges,
const MATRIX2D &  aTransformation,
const ClipRectangle aClipRectangle
const
 

Calculates the edges of the polygon with transformation and clipping to aEdges array.

Note that this may return upto three times the amount of edges that aVertexCount defines, in the unlucky case where both left and right side get clipped for all edges.

Parameters:
aFirstVertex the index for the first vertex.
aVertexCount the amount of vertices to convert.
aEdges the array for result edges. This should be able to contain 2*aVertexCount edges.
aTransformation the transformation matrix for the polygon.
aClipRectangle the clip rectangle.
Returns:
the amount of edges in the result.

int SubPolygon::getScanEdge VertexData aVertexData,
short  aWinding,
PolygonScanEdge aEdges,
const ClipRectangle aClipRectangle
const [inline, protected]
 

Returns the edge(s) between two vertices in aVertexData.

int SubPolygon::getScanEdges PolygonScanEdge aEdges,
const MATRIX2D &  aTransformation,
const ClipRectangle aClipRectangle
const
 

Calculates the edges of the polygon with transformation and clipping to aEdges array.

Note that this may return upto three times the amount of edges that the polygon has vertices, in the unlucky case where both left and right side get clipped for all edges.

Parameters:
aEdges the array for result edges. This should be able to contain 2*aVertexCount edges.
aTransformation the transformation matrix for the polygon.
aClipRectangle the clip rectangle.
Returns:
the amount of edges in the result.

const VECTOR2D& SubPolygon::getVertex int  aIndex  )  const [inline]
 

Returns a vertex at given position.

int SubPolygon::getVertexCount  )  const [inline]
 

Returns the amount of vertices in the polygon.

bool SubPolygon::getVerticalEdge RATIONAL  aStartY,
RATIONAL  aEndY,
RATIONAL  aX,
PolygonEdge aEdge,
const ClipRectangle aClipRectangle
const [protected]
 

Creates a vertical polygon edge between two y values.

Clips the edge vertically to the clip rectangle. Returns true for edges that should be rendered, false for others.

bool SubPolygon::init  ) 
 

Initializer.


Member Data Documentation

int SubPolygon::mVertexCount [protected]
 

VertexData* SubPolygon::mVertexData [protected]
 

VECTOR2D* SubPolygon::mVertices [protected]
 


The documentation for this class was generated from the following files:
Generated on Fri Aug 3 00:44:41 2007 for Scanline edge-flag algorithm for antialiasing by  doxygen 1.4.6-NO