OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MaliSDK::SuperEllipsoidModel Class Reference

Functions for generating super ellipsoid shapes. More...

#include <SuperEllipsoidModel.h>

Static Public Member Functions

static void create (int samples, float n1, float n2, float scale, float **roundedCubeCoordinates, float **roundedCubeNormalVectors, int *numberOfVertices, int *numberOfCoordinates, int *numberOfNormals)
 Function that generates vertices and normal vectors of rounded cube. More...
 
static void create (int samples, float n1, float n2, float scale, float **roundedCubeCoordinates, float **roundedCubeNormalVectors, int *numberOfVertices, int *numberOfCoordinates, int *numberOfNormals)
 Function that generates vertices and normal vectors of rounded cube. More...
 

Static Private Member Functions

static Vec3f calculateNormal (float xyAngle, float xzAngle, float n1, float n2, float scale)
 Compute normal vector of a super ellipsoid. More...
 
static Vec3f sample (float xyAngle, float xzAngle, float n1, float n2, float scale)
 Compute vertex of a super ellipsoid. More...
 
static void storeVertexAndNormalVectorInArray (const Vec3f &vertex, const Vec3f &normalVector, int &vertexIndex, int &normalVectorIndex, float *roundedCubeCoordinates, float *roundedCubeNormalVectors)
 Put vertex and normal vector values into vertex array and normal vector array. More...
 
static Vec3f calculateNormal (float xyAngle, float xzAngle, float n1, float n2, float scale)
 Compute normal vector of a super ellipsoid. More...
 
static Vec3f sample (float xyAngle, float xzAngle, float n1, float n2, float scale)
 Compute vertex of a super ellipsoid. More...
 
static void storeVertexAndNormalVectorInArray (const Vec3f &vertex, const Vec3f &normalVector, int &vertexIndex, int &normalVectorIndex, float *roundedCubeCoordinates, float *roundedCubeNormalVectors)
 Put vertex and normal vector values into vertex array and normal vector array. More...
 

Static Private Attributes

static const int numberOfPointCoordinates = 4
 Number of coordinates for a point in 3D space. More...
 

Detailed Description

Functions for generating super ellipsoid shapes.

Definition at line 31 of file SuperEllipsoidModel.h.

Member Function Documentation

Vec3f MaliSDK::SuperEllipsoidModel::calculateNormal ( float  xyAngle,
float  xzAngle,
float  n1,
float  n2,
float  scale 
)
inlinestaticprivate

Compute normal vector of a super ellipsoid.

Whole shape lies at the centre of a box of dimension (-1, 1) on every axis.

Parameters
[in]xyAngleXY angle for which we compute a vertex.
[in]xzAngleXZ angle for which we compute a vertex.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
Returns
The normal vector of the super ellipsoid.

Definition at line 149 of file SuperEllipsoidModel.cpp.

static Vec3f MaliSDK::SuperEllipsoidModel::calculateNormal ( float  xyAngle,
float  xzAngle,
float  n1,
float  n2,
float  scale 
)
inlinestaticprivate

Compute normal vector of a super ellipsoid.

Whole shape lies at the centre of a box of dimension (-1, 1) on every axis.

Parameters
[in]xyAngleXY angle for which we compute a vertex.
[in]xzAngleXZ angle for which we compute a vertex.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
Returns
The normal vector of the super ellipsoid.
void MaliSDK::SuperEllipsoidModel::create ( int  samples,
float  n1,
float  n2,
float  scale,
float **  roundedCubeCoordinates,
float **  roundedCubeNormalVectors,
int numberOfVertices,
int numberOfCoordinates,
int numberOfNormals 
)
static

Function that generates vertices and normal vectors of rounded cube.

It creates an "unit"-size ellipsoid (-1 to 1) at the origin. This function generates vertices of superellipsoid, a versatile primitive that is controlled by two parameters - n1 and n2. It can represent a sphere, square box, and closed cylindrical can. The parameter samples determine the accuracy of this primitive (if it has sharp or smooth edges). It should be noted that there are some numerical issues with both very small or very large values of n1 and n2 parameters. Typically, for safety, they should be in the range of 0.1 to 5.0. After using this function user should deallocate memory reserved for roundedCubeCoordinates and roundedCubeNormalVectors.

Parameters
[in]samplesThe number of triangles that will create super ellipsoid.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
[out]roundedCubeCoordinatesPointer to an array that holds rounded cube's coordinates.
[out]roundedCubeNormalVectorsPointer to an array that holds rounded cube's normal vectors.
[out]numberOfVerticesNumber of generated vertices.
[out]numberOfCoordinatesNumber of generated coordinates.
[out]numberOfNormalsNumber of generated normal vectors.

Definition at line 30 of file SuperEllipsoidModel.cpp.

static void MaliSDK::SuperEllipsoidModel::create ( int  samples,
float  n1,
float  n2,
float  scale,
float **  roundedCubeCoordinates,
float **  roundedCubeNormalVectors,
int numberOfVertices,
int numberOfCoordinates,
int numberOfNormals 
)
static

Function that generates vertices and normal vectors of rounded cube.

It creates an "unit"-size ellipsoid (-1 to 1) at the origin. This function generates vertices of superellipsoid, a versatile primitive that is controlled by two parameters - n1 and n2. It can represent a sphere, square box, and closed cylindrical can. The parameter samples determine the accuracy of this primitive (if it has sharp or smooth edges). It should be noted that there are some numerical issues with both very small or very large values of n1 and n2 parameters. Typically, for safety, they should be in the range of 0.1 to 5.0. After using this function user should deallocate memory reserved for roundedCubeCoordinates and roundedCubeNormalVectors.

Parameters
[in]samplesThe number of triangles that will create super ellipsoid.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
[out]roundedCubeCoordinatesPointer to an array that holds rounded cube's coordinates.
[out]roundedCubeNormalVectorsPointer to an array that holds rounded cube's normal vectors.
[out]numberOfVerticesNumber of generated vertices.
[out]numberOfCoordinatesNumber of generated coordinates.
[out]numberOfNormalsNumber of generated normal vectors.
Vec3f MaliSDK::SuperEllipsoidModel::sample ( float  xyAngle,
float  xzAngle,
float  n1,
float  n2,
float  scale 
)
inlinestaticprivate

Compute vertex of a super ellipsoid.

Whole shape lies at the centre of a box of dimension (-1, 1) on every axis.

Parameters
[in]xyAngleXY angle for which we compute a vertex.
[in]xzAngleXZ angle for which we compute a vertex.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
Returns
point of the super ellipsoid.

Definition at line 184 of file SuperEllipsoidModel.cpp.

static Vec3f MaliSDK::SuperEllipsoidModel::sample ( float  xyAngle,
float  xzAngle,
float  n1,
float  n2,
float  scale 
)
inlinestaticprivate

Compute vertex of a super ellipsoid.

Whole shape lies at the centre of a box of dimension (-1, 1) on every axis.

Parameters
[in]xyAngleXY angle for which we compute a vertex.
[in]xzAngleXZ angle for which we compute a vertex.
[in]n1The "squareness" of our figure - property that tells how rounded the geometry will be in XZ space.
[in]n2The "squareness" of our figure - property that tells how rounded the geometry will be in XY space.
[in]scaleScale factor applied to the object.
Returns
point of the super ellipsoid.
void MaliSDK::SuperEllipsoidModel::storeVertexAndNormalVectorInArray ( const Vec3f vertex,
const Vec3f normalVector,
int vertexIndex,
int normalVectorIndex,
float roundedCubeCoordinates,
float roundedCubeNormalVectors 
)
inlinestaticprivate

Put vertex and normal vector values into vertex array and normal vector array.

We modify vertexIndex and normalVectorIndex inside this function in order to simplify algorithm in the createSuperEllipsoid function.

Parameters
[in]vertexVertex that will be saved in vertex array.
[in]normalVectorNormal vector that will be saved in normal vector array.
[in]vertexIndexVertex array index where new coordinate should be saved.
[out]normalVectorIndexNormal vector array index where new coordinate should be saved.
[out]roundedCubeCoordinatesPointer to an array that holds rounded cube's coordinates.
[out]roundedCubeNormalVectorsPointer to an array that holds rounded cube's normal vectors.

Definition at line 218 of file SuperEllipsoidModel.cpp.

static void MaliSDK::SuperEllipsoidModel::storeVertexAndNormalVectorInArray ( const Vec3f vertex,
const Vec3f normalVector,
int vertexIndex,
int normalVectorIndex,
float roundedCubeCoordinates,
float roundedCubeNormalVectors 
)
inlinestaticprivate

Put vertex and normal vector values into vertex array and normal vector array.

We modify vertexIndex and normalVectorIndex inside this function in order to simplify algorithm in the createSuperEllipsoid function.

Parameters
[in]vertexVertex that will be saved in vertex array.
[in]normalVectorNormal vector that will be saved in normal vector array.
[in]vertexIndexVertex array index where new coordinate should be saved.
[out]normalVectorIndexNormal vector array index where new coordinate should be saved.
[out]roundedCubeCoordinatesPointer to an array that holds rounded cube's coordinates.
[out]roundedCubeNormalVectorsPointer to an array that holds rounded cube's normal vectors.

Member Data Documentation

const int MaliSDK::SuperEllipsoidModel::numberOfPointCoordinates = 4
staticprivate

Number of coordinates for a point in 3D space.

Definition at line 35 of file SuperEllipsoidModel.h.


The documentation for this class was generated from the following files: