Static Public Member Functions |
static void | calculateTorusControlPointsIndices (unsigned int patchDimension, unsigned int patchInstancesCount, unsigned int controlPointsIndicesCount, unsigned int *controlPointsIndices) |
| Determines an array of indices defining a mesh of control points for instanced torus patches. To simplify mathemathics, it is assumed that torus model consists of 12 circles, each built of 12 points, so it is easy to divide each circle into 4 quadrants and define Bezier surfaces approximating perfectly round torus.
|
static void | calculateTorusPatchData (unsigned int patchDensity, float *patchVertices, unsigned int *patchTriangleIndices) |
| Determines patch data for an instanced torus model.
|
static void | calculateTorusWireframeIndices (unsigned int circlesCount, unsigned int pointsPerCircleCount, unsigned int *indices) |
| Determines indices for glDrawElements() call for wireframed torus.
|
static void | generateTorusVertices (float torusRadius, float cirlceRadius, unsigned int circlesCount, unsigned int poitsPerCircleCount, float *torusVertices) |
| Generate vertices of the torus model. The vertices are grouped in circlesCount circles, where each circle consists of pointsPerCircleCount vertices.
|
static void | generateBezierTorusVertices (float torusRadius, float circleRadius, float *torusVertices) |
| Generate torus vertices applying distortions to some of them. The distortions in control mesh are needed for proper construction of Bezier surface patches. It is assumed that each patch consists of 4 control rows and columns. Hence, in each column and each row, we can distinguish 2 middle control points and 2 edge control points, which are shared between patches. The middle control points have to be moved in such a way that C1 continuity between patches is satisfied. Implemented algorithm assumes that each construction circle contains 12 points and the torus model consists of 12 circles.
|
static void | getSpherePointRepresentation (const float radius, const int numberOfSamples, int *numberOfCoordinates, float **sphereCoordinates) |
| Compute coordinates of points which make up a sphere.
|
static void | getSphereTriangleRepresentation (const float radius, const int numberOfSamples, int *numberOfCoordinates, float **sphereTrianglesCoordinates) |
| Create triangular representation of a sphere. For each point of each circle (excluding last circle) there are two triangles created according to rule described in example below:
|
static void | getCubeTriangleRepresentation (float scalingFactor, int *numberOfCoordinates, float **cubeTrianglesCoordinates) |
| Compute coordinates of points which make up a cube.
|
static void | getCubeNormals (int *numberOfCoordinates, float **cubeNormals) |
| Create normals for a cube which was created with getCubeTriangleRepresentation function.
|
static void | getSquareTriangleRepresentationInXZSpace (float scalingFactor, int *numberOfCoordinates, float **squareCoordinates) |
| Get coordinates of points which make up a square. Square is located in XZ space.
|
static void | getSquareXZNormals (int *numberOfCoordinates, float **squareNormals) |
| Get normals for square placed in XZ space.
|
Functions for generating geometrical shapes.
void MaliSDK::Geometry::getSphereTriangleRepresentation |
( |
const float |
radius, |
|
|
const int |
numberOfSamples, |
|
|
int * |
numberOfCoordinates, |
|
|
float ** |
sphereTrianglesCoordinates |
|
) |
| |
|
static |
Create triangular representation of a sphere. For each point of each circle (excluding last circle) there are two triangles created according to rule described in example below:
A2___________.B2
. \ . / |
|. \ . / |
| . A1____B1 |
| . | |. |
| D1____C1 . |
| / . \ .|
| / . \ .
D2 .___________C2
Points named A1, B1, C1 and D1 create a first circle of sphere and points named A2, B2, C2 and D2 create the second one
(if numberOfSamples is equal to 4). For each loop iteration, for each point lying at one circle of sphere there are 2 triangles created:
for point A1: A1 B1 B2, A1 B2 A2
for point B1: B1 C1 C2, B1 C2 B2
for point C1: C1 D1 D2, C1 D2 C2
for point D1: D1 A1 A2, D1 A2 D2
- Parameters:
-
radius | [in] Radius of a sphere. Has to be greater than zero. |
numberOfSamples | [in] A sphere consists of |
numberOfSamples | circles and |
numberOfSamples | points lying on one circle. Has to be greater than zero. |
numberOfCoordinates | [out] Number of generated coordinates. |
sphereTrianglesCoordinates | [out] Deref will be used to store generated coordinates. Cannot be null. |