Public Member Functions

Polygon Class Reference

Defines a polygon (sometime called n-gons). More...

List of all members.

Public Member Functions

OZCOLLIDE_API Polygon ()
 Creates a new empty polygon.
OZCOLLIDE_API ~Polygon ()
 Destructs this polygon instance.
OZCOLLIDE_API void setNbIndices (int nbIndices)
 Set the number indices of this polygon.
ozinline int getNbIndices () const
 Gets the number of indices used by this polygon.
ozinline void setIndicesMemory (int _nbIndices, int *_indices)
 Force this polygon to use the supplied memory location for its indices.
ozinline int getIndex (int i) const
 Gets a point index for this polygon.
ozinline void setIndex (int i, int index)
 Sets a point index for this polygon.
ozinline const Vec3fgetNormal () const
 Returns the normal of this polygon.
ozinline void setNormal (const Vec3f &normal)
 Sets the normal for this polygon.
OZCOLLIDE_API bool isDegenerate () const
 Tells if this polygon is degenerated.
OZCOLLIDE_API void copyTo (Polygon &) const
 Copies this polygon (nbIndices, indices and normal) to one another polygon.
OZCOLLIDE_API Polygonclone () const
 Clones the polygon.
ozinline Plane calculPlane (const Vec3f *_pnts) const
 Calculates a Plane instance for this polygon.

Detailed Description

Defines a polygon (sometime called n-gons).

A polygon is merely a set of indices defining a set of points. A polygon is, thus, always associated with a list of points.


Constructor & Destructor Documentation

OZCOLLIDE_API Polygon::Polygon (  ) 

Creates a new empty polygon.

OZCOLLIDE_API Polygon::~Polygon (  ) 

Destructs this polygon instance.


Member Function Documentation

ozinline Plane Polygon::calculPlane ( const Vec3f _pnts  )  const [inline]

Calculates a Plane instance for this polygon.

Parameters:
_pnts A list of points to read from (which is associated with the polygon indices).
Returns:
A Plane instance for this polygon.
OZCOLLIDE_API Polygon* Polygon::clone (  )  const

Clones the polygon.

Returns:
A pointer to a cloned polygon.
OZCOLLIDE_API void Polygon::copyTo ( Polygon  )  const

Copies this polygon (nbIndices, indices and normal) to one another polygon.

It causes its content to be erased by this one.

Parameters:
polygon The Polygon where the copy will occur.
ozinline int Polygon::getIndex ( int  i  )  const [inline]

Gets a point index for this polygon.

Returns:
The point index.
ozinline int Polygon::getNbIndices (  )  const [inline]

Gets the number of indices used by this polygon.

A polygon of 1 index is a point, two indices is a line, three indices is a triangle, etc. Maximum number of indices is 255.

ozinline const Vec3f& Polygon::getNormal (  )  const [inline]

Returns the normal of this polygon.

For performance reason, the normal is precalculated.

Returns:
The normal of the polygon.
OZCOLLIDE_API bool Polygon::isDegenerate (  )  const

Tells if this polygon is degenerated.

A degenerated polygon is a polygon where two or more points are the same.

Returns:
true if the polygon is degenerated, false otherwhise.
ozinline void Polygon::setIndex ( int  i,
int  index 
) [inline]

Sets a point index for this polygon.

Parameters:
i The index inside the polygon.
index The point index.
ozinline void Polygon::setIndicesMemory ( int  _nbIndices,
int *  _indices 
) [inline]

Force this polygon to use the supplied memory location for its indices.

That's allow for example a big block of memory to be chunked into several set of indices without the heavy mechanism of new memory allocation for each newly created polygon.

Parameters:
_nbIndices The number of indices of this polygon.
_indices A pointer to the indices, no recopy is made, the pointer will just be further used.
OZCOLLIDE_API void Polygon::setNbIndices ( int  nbIndices  ) 

Set the number indices of this polygon.

Note that changing the number of indices doesn't erase the old content of the object. For example passing from a triangle (3 indices) to a quadrangle (4 indices) keeps the 3 first indices intact. This methods make uses of malloc() and so, is slower than setIndicesMemory()

ozinline void Polygon::setNormal ( const Vec3f normal  )  [inline]

Sets the normal for this polygon.

Parameters:
normal The normal of the polygon.

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator