![]() |
Public API Reference |
#include <poly3d.h>
Inheritance diagram for csPoly3D:
Public Methods | |
csPoly3D (int start_size=10) | |
Make a new empty polygon. More... | |
csPoly3D (const csPoly3D ©) | |
Copy constructor. More... | |
virtual | ~csPoly3D () |
Destructor. More... | |
void | MakeEmpty () |
Initialize the polygon to empty. More... | |
int | GetVertexCount () const |
Get the number of vertices. More... | |
csVector3 * | GetVertices () const |
Get the array with all vertices. More... | |
csVector3 * | GetVertex (int i) const |
Get the specified vertex. More... | |
csVector3 & | operator[] (int i) |
Get the specified vertex. More... | |
csVector3 & | operator[] (int i) const |
Get the specified vertex. More... | |
csVector3 * | GetFirst () const |
Get the first vertex. More... | |
csVector3 * | GetLast () const |
Get the last vertex. More... | |
bool | In (const csVector3 &v) const |
Test if this vector is inside the polygon. More... | |
void | MakeRoom (int new_max) |
Make room for at least the specified number of vertices. More... | |
void | SetVertexCount (int n) |
Set the number of vertices. More... | |
int | AddVertex (const csVector3 &v) |
Add a vertex (3D) to the polygon. More... | |
int | AddVertex (float x, float y, float z) |
Add a vertex (3D) to the polygon. More... | |
void | SetVertices (csVector3 const *v, int num) |
Set all polygon vertices at once. More... | |
bool | ProjectXPlane (const csVector3 &point, float plane_x, csPoly2D *poly2d) const |
Project this polygon onto a X plane as seen from some point in space. More... | |
bool | ProjectYPlane (const csVector3 &point, float plane_y, csPoly2D *poly2d) const |
Project this polygon onto a Y plane as seen from some point in space. More... | |
bool | ProjectZPlane (const csVector3 &point, float plane_z, csPoly2D *poly2d) const |
Project this polygon onto a Z plane as seen from some point in space. More... | |
bool | ProjectAxisPlane (const csVector3 &point, int plane_nr, float plane_pos, csPoly2D *poly2d) const |
Project this polygon onto an axis-aligned plane as seen from some point in space. More... | |
int | Classify (const csPlane3 &pl) const |
Classify this polygon with regards to a plane. More... | |
int | ClassifyX (float x) const |
Same as Classify() but for X plane only. More... | |
int | ClassifyY (float y) const |
Same as Classify() but for Y plane only. More... | |
int | ClassifyZ (float z) const |
Same as Classify() but for Z plane only. More... | |
void | CutToPlane (const csPlane3 &split_plane) |
Cut this polygon with a plane and only keep the front side. More... | |
void | SplitWithPlane (csPoly3D &front, csPoly3D &back, const csPlane3 &split_plane) const |
Split this polygon with the given plane (A,B,C,D). More... | |
void | SplitWithPlaneX (csPoly3D &front, csPoly3D &back, float x) const |
Split this polygon to the x-plane. More... | |
void | SplitWithPlaneY (csPoly3D &front, csPoly3D &back, float y) const |
Split this polygon to the y-plane. More... | |
void | SplitWithPlaneZ (csPoly3D &front, csPoly3D &back, float z) const |
Split this polygon to the z-plane. More... | |
csVector3 | ComputeNormal () const |
Compute the normal of this polygon. More... | |
csPlane3 | ComputePlane () const |
Compute the plane of this polygon. More... | |
float | GetSignedArea () const |
Calculate the signed area of this polygon. More... | |
csVector3 | GetCenter () const |
Compute and get the central vertex of this polygon. More... | |
Static Public Methods | |
bool | In (csVector3 *poly, int num_poly, const csVector3 &v) |
Test if a vector is inside the given polygon. More... | |
int | Classify (const csPlane3 &pl, csVector3 *vertices, int num_vertices) |
Static function to classify a polygon with regards to a plane. More... | |
csVector3 | ComputeNormal (csVector3 *vertices, int num) |
Compute the normal of a polygon. More... | |
csPlane3 | ComputePlane (csVector3 *vertices, int num) |
Compute the plane of a polygon. More... | |
Protected Attributes | |
csVector3 * | vertices |
The 3D vertices. More... |
Definition at line 41 of file poly3d.h.
|
Make a new empty polygon.
|
|
Copy constructor.
|
|
Destructor.
|
|
Add a vertex (3D) to the polygon. Return index of added vertex. |
|
Add a vertex (3D) to the polygon. Return index of added vertex. Definition at line 141 of file poly3d.h. References csVector3::x, csVector3::y, and csVector3::z. |
|
Classify this polygon with regards to a plane. 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. Definition at line 223 of file poly3d.h. References Classify. |
|
Static function to classify a polygon with regards to a plane. 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. Referenced by Classify. |
|
Same as Classify() but for X plane only.
|
|
Same as Classify() but for Y plane only.
|
|
Same as Classify() but for Z plane only.
|
|
Compute the normal of this polygon.
|
|
Compute the normal of a polygon.
|
|
Compute the plane of this polygon.
|
|
Compute the plane of a polygon.
|
|
Cut this polygon with a plane and only keep the front side.
|
|
Compute and get the central vertex of this polygon.
|
|
Get the first vertex.
|
|
Get the last vertex.
|
|
Calculate the signed area of this polygon.
|
|
Get the specified vertex.
|
|
Get the number of vertices.
|
|
Get the array with all vertices.
|
|
Test if a vector is inside the given polygon.
|
|
Test if this vector is inside the polygon.
|
|
Initialize the polygon to empty.
|
|
Make room for at least the specified number of vertices.
Referenced by SetVertexCount, and SetVertices. |
|
Get the specified vertex.
|
|
Get the specified vertex.
|
|
Project this polygon onto an axis-aligned plane as seen from some point in space. Fills the given 2D polygon with the projection on the plane. This function assumes that there actually is a projection. Plane_nr is 0 for the X plane, 1 for Y, and 2 for Z. Definition at line 194 of file poly3d.h. References ProjectXPlane, ProjectYPlane, and ProjectZPlane. |
|
Project this polygon onto a X plane as seen from some point in space. Fills the given 2D polygon with the projection on the plane. This function assumes that there actually is a projection. If the polygon to project comes on the same plane as 'point' then it will return false (no valid projection). Referenced by ProjectAxisPlane. |
|
Project this polygon onto a Y plane as seen from some point in space. Fills the given 2D polygon with the projection on the plane. This function assumes that there actually is a projection. If the polygon to project comes on the same plane as 'point' then it will return false (no valid projection). Referenced by ProjectAxisPlane. |
|
Project this polygon onto a Z plane as seen from some point in space. Fills the given 2D polygon with the projection on the plane. This function assumes that there actually is a projection. If the polygon to project comes on the same plane as 'point' then it will return false (no valid projection). Referenced by ProjectAxisPlane. |
|
Set the number of vertices.
Definition at line 135 of file poly3d.h. References MakeRoom. |
|
Set all polygon vertices at once. Copies the array. Definition at line 152 of file poly3d.h. References MakeRoom. |
|
Split this polygon with the given plane (A,B,C,D).
|
|
Split this polygon to the x-plane.
|
|
Split this polygon to the y-plane.
|
|
Split this polygon to the z-plane.
|
|
The 3D vertices.
|