CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csPolygonMeshTools Class Reference
[Geometry utilities]

A set of tools to work with iPolygonMesh instances. More...

#include <pmtools.h>

List of all members.

Static Public Methods

void CalculateNormals (iPolygonMesh *mesh, csVector3 *normals)
 This function will calculate normals for all polygons in the mesh. More...

void CalculatePlanes (iPolygonMesh *mesh, csPlane3 *planes)
 This function will calculate planes for all polygons in the mesh. More...

csPolygonMeshEdgeCalculateEdges (iPolygonMesh *, int &num_edges)
 Create a table of edges for this mesh. More...

int CheckActiveEdges (csPolygonMeshEdge *edges, int num_edges, csPlane3 *planes)
 This function will check all edges and mark them as active if the two polygons are not co-planar. More...

void CalculateOutline (csPolygonMeshEdge *edges, int num_edges, csPlane3 *planes, int num_vertices, const csVector3 &pos, int *outline_edges, int &num_outline_edges, bool *outline_verts, float &valid_radius)
 Given a table of edges (as calculated with CalculateEdges()), a table of planes (as calculated with CalculatePlanes()), and a position in space. More...


Detailed Description

A set of tools to work with iPolygonMesh instances.

Definition at line 54 of file pmtools.h.


Member Function Documentation

csPolygonMeshEdge* csPolygonMeshTools::CalculateEdges iPolygonMesh  ,
int &    num_edges
[static]
 

Create a table of edges for this mesh.

The resulting table may later be deleted with 'delete[]'. Note that every edge will only connect two polygons. If more polygons connect to an edge then the edge will be duplicated. The 'active' flag of the returned edges is not calculated by this routine. Use 'CheckActiveEdges()' for that.

void csPolygonMeshTools::CalculateNormals iPolygonMesh   mesh,
csVector3   normals
[static]
 

This function will calculate normals for all polygons in the mesh.

The given array of 'normals' should be big enough to have normals for the number of polygons as defined in the mesh itself.

void csPolygonMeshTools::CalculateOutline csPolygonMeshEdge   edges,
int    num_edges,
csPlane3   planes,
int    num_vertices,
const csVector3   pos,
int *    outline_edges,
int &    num_outline_edges,
bool *    outline_verts,
float &    valid_radius
[static]
 

Given a table of edges (as calculated with CalculateEdges()), a table of planes (as calculated with CalculatePlanes()), and a position in space.

This function will calculate an outline that is valid from that position. This outline will be given as an array of bool indicating which vertex indices that are used (so these have to be transformed from 3D to 2D) and also an array of double vertex indices (every set of two vertex indices forms one edge) that form the outline. This function will also return a radius. As long as the position doesn't move outside this radius the outline will be valid. The two input tables should have enough space for the returned number of edges and vertex indices. The safest way is to allocate double the amount of vertices as there are active edges in the input edge table and enough vertices as the polygon mesh supports.
Note: this function requires that the given edges are marked as active or not (use CheckActiveEdges()).
Note: num_outline_edges will be the amount of edges (which means that there will be twice as much vertices in the 'outline_edges' table.

void csPolygonMeshTools::CalculatePlanes iPolygonMesh   mesh,
csPlane3   planes
[static]
 

This function will calculate planes for all polygons in the mesh.

The given array of 'planes' should be big enough to have planes for the number of polygons as defined in the mesh itself.

int csPolygonMeshTools::CheckActiveEdges csPolygonMeshEdge   edges,
int    num_edges,
csPlane3   planes
[static]
 

This function will check all edges and mark them as active if the two polygons are not co-planar.

This function will return the number of active edges.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14