Defines a polygon (sometime called n-gons). More...
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 Vec3f & | getNormal () 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 Polygon * | clone () const |
| Clones the polygon. | |
| ozinline Plane | calculPlane (const Vec3f *_pnts) const |
| Calculates a Plane instance for this polygon. | |
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.
| OZCOLLIDE_API Polygon::Polygon | ( | ) |
Creates a new empty polygon.
| OZCOLLIDE_API Polygon::~Polygon | ( | ) |
Destructs this polygon instance.
| OZCOLLIDE_API Polygon* Polygon::clone | ( | ) | const |
Clones the 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.
| polygon | The Polygon where the copy will occur. |
| ozinline int Polygon::getIndex | ( | int | i | ) | const [inline] |
Gets a point index for this polygon.
| 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.
| 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.
| ozinline void Polygon::setIndex | ( | int | i, | |
| int | index | |||
| ) | [inline] |
Sets a point index for this polygon.
| 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.
| _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.
| normal | The normal of the polygon. |
1.7.1