Vuo  2.0.0
Macros | Enumerations | Functions
VuoMeshUtility.cc File Reference

Description

VuoMeshUtility implementation.

Definition in file VuoMeshUtility.cc.

Go to the source code of this file.

Macros

#define PI   3.14159265359
 Constant providing the ratio of a circle's circumference to its diameter. More...
 

Enumerations

enum  Plane {
  PlaneX, PlaneY, PlaneZ, PlaneNegX,
  PlaneNegY, PlaneNegZ
}
 Defines a direction on the X, Y, or Z axis (and their negated direction). More...
 

Functions

static VuoPoint4d VuoPoint4d_min (const VuoPoint4d lhs, const VuoPoint4d rhs)
 Returns component-wise min, ignoring W. More...
 
static VuoPoint4d VuoPoint4d_max (const VuoPoint4d lhs, const VuoPoint4d rhs)
 Returns component-wise max, ignoring W. More...
 
void VuoMeshUtility_calculateNormals (VuoSubmesh *submesh)
 Calculates the normal for each vertex in this submesh. More...
 
void VuoMeshUtility_calculateTangents (VuoSubmesh *submesh)
 Calculates tangents and bitangents for a mesh given vertices, textures, normals, and triangles. More...
 
bool VuoMeshUtility_bounds (const VuoSubmesh mesh, VuoPoint4d *min, VuoPoint4d *max)
 Get the bounds of a submesh. More...
 
void VuoMeshUtility_calculateSphericalUVs (VuoSubmesh *submesh)
 Generate UVs by calculating each vertex position as projected onto a bounding sphere. More...
 
Plane VuoMeshUtility_calculateBestPlane (VuoPoint4d normal)
 Returns the plane with the axis most similar to normal. More...
 
static VuoPoint4d VuoMeshUtility_averageNormal (VuoPoint4d a, VuoPoint4d b, VuoPoint4d c)
 Averages the x, y, z components of points a, b, c. More...
 
void VuoMeshUtility_calculateCubicUVs (VuoSubmesh *submesh)
 Generate cubic UVs for this submesh. More...
 
void VuoMeshUtility_calculateCubicUVsPerTriangle (VuoSubmesh *submesh)
 Generate cubic UVs for this submesh, using the triangle normal to project UV instead of vertex normal. More...
 
static float dot (const VuoPoint4d lhs, const VuoPoint4d rhs)
 Dot product of XYZ values in 4d points. More...
 
static bool VuoPoint4d_equals (const VuoPoint4d a, const VuoPoint4d b)
 Returns true if a is equal to b within a tolerance of a very small value. More...
 
void VuoMeshUtility_insertSeam (VuoSubmesh *submesh)
 Inserts a seam on a submesh. More...
 
static int compare (const void *lhs, const void *rhs)
 Compare function for triangle ordering qsort in removeUnusedVertices. More...
 
void VuoMeshUtility_removeUnusedVertices (VuoSubmesh *mesh)
 Removes unused vertices from a mesh. More...
 

Macro Definition Documentation

◆ PI

#define PI   3.14159265359

Constant providing the ratio of a circle's circumference to its diameter.

Definition at line 28 of file VuoMeshUtility.cc.

Enumeration Type Documentation

◆ Plane

enum Plane

Defines a direction on the X, Y, or Z axis (and their negated direction).

Definition at line 397 of file VuoMeshUtility.cc.

Function Documentation

◆ compare()

static int compare ( const void *  lhs,
const void *  rhs 
)
static

Compare function for triangle ordering qsort in removeUnusedVertices.

Definition at line 702 of file VuoMeshUtility.cc.

◆ dot()

static float dot ( const VuoPoint4d  lhs,
const VuoPoint4d  rhs 
)
static

Dot product of XYZ values in 4d points.

Definition at line 544 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_averageNormal()

static VuoPoint4d VuoMeshUtility_averageNormal ( VuoPoint4d  a,
VuoPoint4d  b,
VuoPoint4d  c 
)
inlinestatic

Averages the x, y, z components of points a, b, c.

Definition at line 428 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_bounds()

bool VuoMeshUtility_bounds ( const VuoSubmesh  mesh,
VuoPoint4d *  min,
VuoPoint4d *  max 
)

Get the bounds of a submesh.

Definition at line 305 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateBestPlane()

Plane VuoMeshUtility_calculateBestPlane ( VuoPoint4d  normal)

Returns the plane with the axis most similar to normal.

Ex: { .2, .1, .9 } returns PlaneZ.

Definition at line 410 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateCubicUVs()

void VuoMeshUtility_calculateCubicUVs ( VuoSubmesh submesh)

Generate cubic UVs for this submesh.

Works best with IndividualTriangles meshes where no vertex is shared between triangles.

Definition at line 439 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateCubicUVsPerTriangle()

void VuoMeshUtility_calculateCubicUVsPerTriangle ( VuoSubmesh submesh)

Generate cubic UVs for this submesh, using the triangle normal to project UV instead of vertex normal.

Definition at line 483 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateNormals()

void VuoMeshUtility_calculateNormals ( VuoSubmesh submesh)

Calculates the normal for each vertex in this submesh.

Generate normals for this submesh.

Vertices pointed at by multiple element indices will be averaged.

Definition at line 60 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateSphericalUVs()

void VuoMeshUtility_calculateSphericalUVs ( VuoSubmesh submesh)

Generate UVs by calculating each vertex position as projected onto a bounding sphere.

Generate spherical UVs for this submesh.

https://en.wikipedia.org/wiki/UV_mapping

Definition at line 329 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_calculateTangents()

void VuoMeshUtility_calculateTangents ( VuoSubmesh submesh)

Calculates tangents and bitangents for a mesh given vertices, textures, normals, and triangles.

Generate tangents and bitangents for this submesh.

Assumes triangles are wound using VuoMesh_IndividualTriangles, and that the positions, textures, normals, and triangles arrays are valid. Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html

Definition at line 145 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_insertSeam()

void VuoMeshUtility_insertSeam ( VuoSubmesh submesh)

Inserts a seam on a submesh.

Inserts a seam along a vertical line on the left side of a mesh.

May (probably will) leave unused vertices.

Definition at line 564 of file VuoMeshUtility.cc.

◆ VuoMeshUtility_removeUnusedVertices()

void VuoMeshUtility_removeUnusedVertices ( VuoSubmesh mesh)

Removes unused vertices from a mesh.

Remove unused vertices in a mesh.

Definition at line 710 of file VuoMeshUtility.cc.

◆ VuoPoint4d_equals()

static bool VuoPoint4d_equals ( const VuoPoint4d  a,
const VuoPoint4d  b 
)
static

Returns true if a is equal to b within a tolerance of a very small value.

Definition at line 552 of file VuoMeshUtility.cc.

◆ VuoPoint4d_max()

static VuoPoint4d VuoPoint4d_max ( const VuoPoint4d  lhs,
const VuoPoint4d  rhs 
)
inlinestatic

Returns component-wise max, ignoring W.

Definition at line 46 of file VuoMeshUtility.cc.

◆ VuoPoint4d_min()

static VuoPoint4d VuoPoint4d_min ( const VuoPoint4d  lhs,
const VuoPoint4d  rhs 
)
inlinestatic

Returns component-wise min, ignoring W.

Definition at line 33 of file VuoMeshUtility.cc.