Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csPolygonInt Class Reference

This class indicates what methods a class should use in order to be a 'polygon'. More...

#include <polyint.h>

Inheritance diagram for csPolygonInt:

csBspPolygon csPolygon3D List of all members.

Public Methods

 csPolygonInt ()
 Constructor. Init ref counter to 1.

void IncRefCount ()
 Increase the reference counter in this csPolygonInt.

bool DecRefCount ()
 Decrease the reference counter. More...

bool IsReferenced ()
 Return false if object is not referenced.

virtual csPlane3GetPolyPlane ()=0
 Return the plane of this polygon.

virtual int Classify (const csPlane3 &pl)=0
 Classify this polygon with regards to a plane (in world space). More...

virtual int ClassifyX (float x)
 Classify to X plane. More...

virtual int ClassifyY (float y)
 Classify to Y plane. More...

virtual int ClassifyZ (float z)
 Classify to Z plane. More...

virtual void SplitWithPlane (csPolygonInt **front, csPolygonInt **back, const csPlane3 &plane)=0
 Split this polygon with the given plane (A,B,C,D) and return the two resulting new polygons in 'front' and 'back'. More...

virtual void SplitWithPlaneX (csPolygonInt **front, csPolygonInt **back, float x)
 Split this polygon with the X plane. More...

virtual void SplitWithPlaneY (csPolygonInt **front, csPolygonInt **back, float y)
 Split this polygon with the Y plane. More...

virtual void SplitWithPlaneZ (csPolygonInt **front, csPolygonInt **back, float z)
 Split this polygon with the Z plane. More...

virtual int GetType ()=0
 Return some type-id which BSP visitors can use for their own purpose. More...

virtual int GetVertexCount ()=0
 Get number of vertices for this polygon.

virtual int* GetVertexIndices ()=0
 Get pointer to array of vertex indices.

virtual csPolygonInt* GetUnsplitPolygon ()=0
 If known and if there is any, return the pointer to the original unsplit polygon.

virtual bool Overlaps (csPolygonInt *overlapped)=0
 Compare this polygon to the other one. More...


Friends

class  csPolygonIntPool

Detailed Description

This class indicates what methods a class should use in order to be a 'polygon'.

It acts as an 'interface' in JAVA terminology. There is no data in this class and no method implementations.

The BSP tree implementation is an example of a class that uses this csPolygonInt interface. The consequence of this is that the BSP tree can be used for several sorts of polygons (even 3D or 2D ones). The csOctree class also uses csPolygonInt.


Member Function Documentation

int csPolygonInt::Classify ( const csPlane3 & pl ) [pure virtual]
 

Classify this polygon with regards to a plane (in world space).

If this poly is on same plane it returns CS_POL_SAME_PLANE. If this poly is completely in front of the given plane it returnes CS_POL_FRONT. If this poly is completely back of the given plane it returnes CS_POL_BACK. Otherwise it returns CS_POL_SPLIT_NEEDED.

Reimplemented in csBspPolygon, and csPolygon3D.

int csPolygonInt::ClassifyX ( float x ) [inline, virtual]
 

Classify to X plane.

The default implementation just calls Classify() above with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon, and csPolygon3D.

int csPolygonInt::ClassifyY ( float y ) [inline, virtual]
 

Classify to Y plane.

The default implementation just calls Classify() above with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon, and csPolygon3D.

int csPolygonInt::ClassifyZ ( float z ) [inline, virtual]
 

Classify to Z plane.

The default implementation just calls Classify() above with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon, and csPolygon3D.

bool csPolygonInt::DecRefCount ( ) [inline]
 

Decrease the reference counter.

This function returns false as soon as the reference counter reaches zero. The object is NOT deleted automatically in that case.

int csPolygonInt::GetType ( ) [pure virtual]
 

Return some type-id which BSP visitors can use for their own purpose.

The purpose of this is to allow several different types of polygons to be added to the same tree. With this number you can recognize them.

Reimplemented in csBspPolygon, and csPolygon3D.

bool csPolygonInt::Overlaps ( csPolygonInt * overlapped ) [pure virtual]
 

Compare this polygon to the other one.

If there exists a position in space where this polygon would overlap the other then return true. The other polygon is not guaranteed to have the same type but it is guaranteed to be part of the same set of added polygon then this one. So the type should always be known.

Reimplemented in csBspPolygon, and csPolygon3D.

void csPolygonInt::SplitWithPlane ( csPolygonInt ** front,
csPolygonInt ** back,
const csPlane3 & plane ) [pure virtual]
 

Split this polygon with the given plane (A,B,C,D) and return the two resulting new polygons in 'front' and 'back'.

The new polygons will mimic the behaviour of the parent polygon as good as possible. Note that the 'front' should be the negative side of the plane and 'back' the positive side.

Reimplemented in csBspPolygon, and csPolygon3D.

void csPolygonInt::SplitWithPlaneX ( csPolygonInt ** front,
csPolygonInt ** back,
float x ) [inline, virtual]
 

Split this polygon with the X plane.

Default implementation just calls SplitWithPlane() with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon.

void csPolygonInt::SplitWithPlaneY ( csPolygonInt ** front,
csPolygonInt ** back,
float y ) [inline, virtual]
 

Split this polygon with the Y plane.

Default implementation just calls SplitWithPlane() with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon.

void csPolygonInt::SplitWithPlaneZ ( csPolygonInt ** front,
csPolygonInt ** back,
float z ) [inline, virtual]
 

Split this polygon with the Z plane.

Default implementation just calls SplitWithPlane() with a constructed plane but this function can be overridden for more efficiency.

Reimplemented in csBspPolygon.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000