AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agxUtil::PrimitiveMeshGenerator Class Reference

#include <PrimitiveMeshGenerator.h>

Static Public Member Functions

static agxCollide::ConvexRef createBox (const agx::Vec3 &halfExtents)
 Creates a convex box with 24 vertices.
 
static agxCollide::RenderDataRef createBoxRenderData (const agx::Vec3 &halfExtents)
 Creates a RenderData with per vertex normals and texture coordinates of a box.
 
static agx::Vec3Vector createBoxVertices (const agx::Vec3 &halfExtents)
 Creates box of given half extents.
 
static agxCollide::ConvexRef createCapsule (agx::Real radius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates a convex capsule.
 
static agx::Vec3Vector createCapsuleVertices (agx::Real radius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates capsule vertices.
 
static void createCircleVertices (agx::UInt numSegments, agx::Real radius, agx::Real yOffset, agx::Bool top, agx::Vec3Vector &vertices, agx::Bool useCenter=true)
 Creates circle of given radius.
 
static agxCollide::ConvexRef createCone (agx::Real topRadius, agx::Real bottomRadius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates a convex cone.
 
static void createConeCapVertices (agx::UInt numSegments, agx::Real topRadius, agx::Real bottomRadius, agx::Real height, agx::Real basey, agx::Vec3Vector &vertices)
 Creates a cone cap given radii and height.
 
static agx::Vec3Vector createConeVertices (agx::Real topRadius, agx::Real bottomRadius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates a convex cone vertices.
 
static agxCollide::ConvexRef createConvex (const agxCollide::Shape *shape, agx::Real resolution=agx::Real(1))
 Creates convex given shape of primitive type BOX, CAPSULE, CYLINDER or SPHERE.
 
static agx::Vec3Vector createConvexVertices (const agxCollide::Shape *shape, agx::Real resolution=agx::Real(1))
 Creates convex vertices given shape of primitive type BOX, CAPSULE, CYLINDER or SPHERE.
 
static agxCollide::ConvexRef createCylinder (agx::Real radius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates a convex cylinder.
 
static void createCylinderCapVertices (agx::UInt numSegments, agx::Real radius, agx::Real height, agx::Vec3Vector &vertices)
 Creates cylinder cap of given radius and height.
 
static agxCollide::RenderDataRef createCylinderRenderData (agx::Real radius, agx::Real height, agx::UInt32 numCircleSegments=32)
 Creates a RenderData with per vertex normals and texture coordinates of a cylinder.
 
static agx::Vec3Vector createCylinderVertices (agx::Real radius, agx::Real height, agx::Real resolution=agx::Real(1))
 Creates cylinder vertices.
 
static void createHalfSphereVertices (agx::UInt numSegments, agx::UInt numRows, agx::Real radius, agx::Bool top, agx::Real yOffset, agx::Vec3Vector &vertices)
 Creates vertices of a half-sphere of given radius.
 
static void createHalfSphereVerticesIndices (agx::Real radius, agx::Bool top, agx::Vec3Vector &vertices, agx::UInt32Vector &indices, agx::Real yOffset=0.0, agx::Real resolution=1.0)
 Create vertices and indices of a half-sphere of a given radius.
 
static agxCollide::TrimeshRef createHollowCone (agx::Real topOuterRadius, agx::Real bottomInnerRadius, agx::Real outerHeight, agx::Real thickness, agx::Real resolution=agx::Real(1))
 Creates a trimesh of a hollow cone.
 
static agxCollide::TrimeshRef createHollowCylinder (agx::Real innerRadius, agx::Real height, agx::Real thickness, agx::Real resolution=agx::Real(1))
 Creates a trimesh of a hollow cylinder.
 
static agxCollide::TrimeshRef createMesh (const agxCollide::Shape *shape, agx::Real resolution=agx::Real(1))
 Creates a mesh given a primitive shape.
 
static agxCollide::ConvexRef createSphere (agx::Real radius, agx::Real resolution=agx::Real(1))
 Creates a convex sphere.
 
static agxCollide::RenderDataRef createSphereRenderData (agx::Real radius, agx::UInt32 numSegments=32)
 Creates a RenderData with per vertex normals and texture coordinates of a sphere.
 
static agx::Vec3Vector createSphereVertices (agx::Real radius, agx::Real resolution=agx::Real(1))
 Creates sphere vertices.
 
static agxCollide::ConvexRef generateVoronoiPolyhedraMesh (agx::Vec3 size, unsigned int seed, agx::Real pointDistance=0.75, agx::Real boundSize=5)
 Create a polyhedra mesh from a randomly generated Voronoi Diagram by using the method described in: https://www.sciencedirect.com/science/article/pii/S0032591014005191.
 
static agx::Vec3Vector generateVoronoiPolyhedraVertices (unsigned int seed, agx::Real pointDistance=0.75, agx::Real boundSize=5.0)
 Create polyhedra points from a randomly generated Voronoi Diagram by using the method described in: https://www.sciencedirect.com/science/article/pii/S0032591014005191.
 

Detailed Description

Definition at line 32 of file PrimitiveMeshGenerator.h.

Member Function Documentation

◆ createBox()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createBox ( const agx::Vec3 halfExtents)
static

Creates a convex box with 24 vertices.

Parameters
halfExtents- box half extents
Returns
convex shape

◆ createBoxRenderData()

static agxCollide::RenderDataRef agxUtil::PrimitiveMeshGenerator::createBoxRenderData ( const agx::Vec3 halfExtents)
static

Creates a RenderData with per vertex normals and texture coordinates of a box.

Parameters
halfExtents- the half extents of the box
Returns
RenderData of a box

◆ createBoxVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createBoxVertices ( const agx::Vec3 halfExtents)
static

Creates box of given half extents.

24 vertices.

Parameters
halfExtents- box half extents
Returns
box vertices

◆ createCapsule()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createCapsule ( agx::Real  radius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a convex capsule.

Parameters
radius- radius of the capsule
height- height of the capsule
resolution- resolution scaler, higher value results in more triangles
Returns
convex shape

◆ createCapsuleVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createCapsuleVertices ( agx::Real  radius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates capsule vertices.

Parameters
radius- radius of the capsule
height- height of the capsule
resolution- resolution scaler, higher value results in more triangles
Returns
capsule vertices

◆ createCircleVertices()

static void agxUtil::PrimitiveMeshGenerator::createCircleVertices ( agx::UInt  numSegments,
agx::Real  radius,
agx::Real  yOffset,
agx::Bool  top,
agx::Vec3Vector vertices,
agx::Bool  useCenter = true 
)
static

Creates circle of given radius.

Parameters
numSegments- number of circle segments
radius- radius of the circle
yOffset- offset along local y axis
top- true if this is the top, i.e., normals pointing in positive y axis
[out]vertices- container with vertices
useCenter- creates a vertex in the middle of the circle if true (default). Otherwise it creates a ring.

◆ createCone()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createCone ( agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a convex cone.

Parameters
topRadius- radius on the top of the cone
bottomRadius- radius on the bottom of the cone
height- height of the cone
resolution- resolution scaler, higher value results in more triangles
Returns
convex shape of a cone

◆ createConeCapVertices()

static void agxUtil::PrimitiveMeshGenerator::createConeCapVertices ( agx::UInt  numSegments,
agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height,
agx::Real  basey,
agx::Vec3Vector vertices 
)
static

Creates a cone cap given radii and height.

Parameters
numSegments- number of circle segments
topRadius- radius of the top of the cone
bottomRadius- radius of the bottom of the cone
height- the height of the cone
basey- the y value for the bottom of the cone
[out]vertices- container with vertices

◆ createConeVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createConeVertices ( agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a convex cone vertices.

Parameters
topRadius- the top radius of the cone
bottomRadius- the bottom radius of the cone
height- the height of the cone
resolution- resolution scaler, higher value results in more triangles
Returns
cone vertices

◆ createConvex()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createConvex ( const agxCollide::Shape shape,
agx::Real  resolution = agx::Real(1) 
)
static

Creates convex given shape of primitive type BOX, CAPSULE, CYLINDER or SPHERE.

Any other type is ignored and nullptr is returned.

Parameters
shape- primitive shape of type BOX, CAPSULE, CYLINDER or SPHERE
resolution- resolution scaler, higher value results in more triangles (ignored if BOX)
Returns
convex shape if successful - otherwise nullptr

◆ createConvexVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createConvexVertices ( const agxCollide::Shape shape,
agx::Real  resolution = agx::Real(1) 
)
static

Creates convex vertices given shape of primitive type BOX, CAPSULE, CYLINDER or SPHERE.

Any other type is ignored and an empty vector is returned.

Parameters
shape- primitive shape of type BOX, CAPSULE, CYLINDER or SPHERE
resolution- resolution scaler, higher value results in more triangles (ignored if BOX)
Returns
convex shape vertices if successful - otherwise empty vector

◆ createCylinder()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createCylinder ( agx::Real  radius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a convex cylinder.

Parameters
radius- radius of the cylinder
height- height of the cylinder
resolution- resolution scaler, higher value results in more triangles
Returns
convex shape

◆ createCylinderCapVertices()

static void agxUtil::PrimitiveMeshGenerator::createCylinderCapVertices ( agx::UInt  numSegments,
agx::Real  radius,
agx::Real  height,
agx::Vec3Vector vertices 
)
static

Creates cylinder cap of given radius and height.

Parameters
numSegments- number of segment about the cylinder axis
radius- radius of the cylinder cap
height- height of the cylinder cap
[out]vertices- container with vertices

◆ createCylinderRenderData()

static agxCollide::RenderDataRef agxUtil::PrimitiveMeshGenerator::createCylinderRenderData ( agx::Real  radius,
agx::Real  height,
agx::UInt32  numCircleSegments = 32 
)
static

Creates a RenderData with per vertex normals and texture coordinates of a cylinder.

Parameters
radius- the radius of the cylinder
height- the height of the cylinder
numCircleSegments- number of circle segments, determines the resolution
Returns
RenderData of a cylinder

◆ createCylinderVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createCylinderVertices ( agx::Real  radius,
agx::Real  height,
agx::Real  resolution = agx::Real(1) 
)
static

Creates cylinder vertices.

Parameters
radius- radius of the cylinder
height- height of the cylinder
resolution- resolution scaler, higher value results in more triangles
Returns
cylinder vertices

◆ createHalfSphereVertices()

static void agxUtil::PrimitiveMeshGenerator::createHalfSphereVertices ( agx::UInt  numSegments,
agx::UInt  numRows,
agx::Real  radius,
agx::Bool  top,
agx::Real  yOffset,
agx::Vec3Vector vertices 
)
static

Creates vertices of a half-sphere of given radius.

Parameters
numSegments- number of circle segments
numRows- number of rows in "height"
radius- base radius of the half-sphere
top- true if this sphere is the top of a complete sphere (top along y axis)
yOffset- offset of this half-sphere along local y axis
[out]vertices- container with vertices

◆ createHalfSphereVerticesIndices()

static void agxUtil::PrimitiveMeshGenerator::createHalfSphereVerticesIndices ( agx::Real  radius,
agx::Bool  top,
agx::Vec3Vector vertices,
agx::UInt32Vector indices,
agx::Real  yOffset = 0.0,
agx::Real  resolution = 1.0 
)
static

Create vertices and indices of a half-sphere of a given radius.

Parameters
radius- radius of the half-sphere
top- true if this sphere is the top of a complete sphere (top along y axis)
[out]vertices- generated vertices
[out]indices- generated triangle indicies (size: 3 * num_triangles)
yOffset- offset of this half-sphere along local y axis
resolution- resolution scaler, higher value results in more triangles

◆ createHollowCone()

static agxCollide::TrimeshRef agxUtil::PrimitiveMeshGenerator::createHollowCone ( agx::Real  topOuterRadius,
agx::Real  bottomInnerRadius,
agx::Real  outerHeight,
agx::Real  thickness,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a trimesh of a hollow cone.

Parameters
topOuterRadius- radius of the outer top of the hollow cone
bottomInnerRadius- radius of the inner bottom of the hollow cone
outerHeight- height of the hollow cone
thickness- thickness of the hollow cone
resolution- resolution scaler, higher value results in more triangles
Returns
trimesh shape of a hollow cone

◆ createHollowCylinder()

static agxCollide::TrimeshRef agxUtil::PrimitiveMeshGenerator::createHollowCylinder ( agx::Real  innerRadius,
agx::Real  height,
agx::Real  thickness,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a trimesh of a hollow cylinder.

Parameters
innerRadius- radius of the inner surface of the cylinder
height- height of the cylinder
resolution- resolution scaler, higher value results in more triangles
Returns
trimesh shape of a hollow cylinder

◆ createMesh()

static agxCollide::TrimeshRef agxUtil::PrimitiveMeshGenerator::createMesh ( const agxCollide::Shape shape,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a mesh given a primitive shape.

Parameters
shape- primitive shape
resolution- resolution scaler, higher value results in more triangles (ignored if BOX)
Returns
a mesh if successful, otherwise nullptr

◆ createSphere()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::createSphere ( agx::Real  radius,
agx::Real  resolution = agx::Real(1) 
)
static

Creates a convex sphere.

Parameters
radius- radius of the sphere
resolution- resolution scaler, higher value results in more triangles
Returns
convex shape

◆ createSphereRenderData()

static agxCollide::RenderDataRef agxUtil::PrimitiveMeshGenerator::createSphereRenderData ( agx::Real  radius,
agx::UInt32  numSegments = 32 
)
static

Creates a RenderData with per vertex normals and texture coordinates of a sphere.

Parameters
radius- the radius of the sphere
numSegments- the vertical and horizontal number of segments, determines the resolution
Returns
RenderData of a sphere

◆ createSphereVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::createSphereVertices ( agx::Real  radius,
agx::Real  resolution = agx::Real(1) 
)
static

Creates sphere vertices.

Parameters
radius- radius of the sphere
resolution- resolution scaler, higher value results in more triangles
Returns
sphere vertices

◆ generateVoronoiPolyhedraMesh()

static agxCollide::ConvexRef agxUtil::PrimitiveMeshGenerator::generateVoronoiPolyhedraMesh ( agx::Vec3  size,
unsigned int  seed,
agx::Real  pointDistance = 0.75,
agx::Real  boundSize = 5 
)
static

Create a polyhedra mesh from a randomly generated Voronoi Diagram by using the method described in: https://www.sciencedirect.com/science/article/pii/S0032591014005191.

The polyhedra is created by taking the center cell of a Voronoi diagram generated from randomly placed equidistant point in a bound. The vertices of the center cell are used to generate a convex shape. The scale parameter is used to modify the generated points in the x, y and z dimensions to create shapes of different sizes and aspect ratios.

Parameters
seed- the seed used to generate the random points in the Vornoi Diagram.
size- scale factors in the x,y and z dimensions used to modify the generated vertices.
pointDistance- the minimum distance between the generated points in the Voronoi diagram.
boundSize- The size of the Voronoi Diagram bound.
Returns
a convex shape of the generated polyhedra.

◆ generateVoronoiPolyhedraVertices()

static agx::Vec3Vector agxUtil::PrimitiveMeshGenerator::generateVoronoiPolyhedraVertices ( unsigned int  seed,
agx::Real  pointDistance = 0.75,
agx::Real  boundSize = 5.0 
)
static

Create polyhedra points from a randomly generated Voronoi Diagram by using the method described in: https://www.sciencedirect.com/science/article/pii/S0032591014005191.

The polyhedra is created by taking the center cell of a Voronoi diagram generated from randomly placed equidistant point in a bound. The vertices of the center cell of the diagram are extracted and returned.

Parameters
seed- the seed used to generate the random points in the Vornoi Diagram.
pointDistance- the minimum distance between the generated points in the Voronoi diagram.
boundSize- The size of the Voronoi Diagram bound.
Returns
a vector of the vertices of the generated polyhedra cell.

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