HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeomUtilCapsuleMeshGenerator Class Referencefinal

#include <capsuleMeshGenerator.h>

+ Inheritance diagram for GeomUtilCapsuleMeshGenerator:

Static Public Member Functions

static GEOMUTIL_API size_t ComputeNumPoints (const size_t numRadial, const size_t numCapAxial, const bool closedSweep=true)
 
static size_t ComputeNumNormals (const size_t numRadial, const size_t numCapAxial, const bool closedSweep=true)
 
static TfToken GetNormalsInterpolation ()
 
static GEOMUTIL_API
PxOsdMeshTopology 
GenerateTopology (const size_t numRadial, const size_t numCapAxial, const bool closedSweep=true)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeneratePoints (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType radius, const ScalarType height, const GfMatrix4d *framePtr=nullptr)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeneratePoints (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType bottomRadius, const ScalarType topRadius, const ScalarType height, const GfMatrix4d *framePtr=nullptr)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeneratePoints (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType bottomRadius, const ScalarType topRadius, const ScalarType height, const ScalarType sweepDegrees, const GfMatrix4d *framePtr=nullptr)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GenerateNormals (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType radius, const ScalarType height, const GfMatrix4d *framePtr=nullptr)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GenerateNormals (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType bottomRadius, const ScalarType topRadius, const ScalarType height, const GfMatrix4d *framePtr=nullptr)
 
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GenerateNormals (PointIterType iter, const size_t numRadial, const size_t numCapAxial, const ScalarType bottomRadius, const ScalarType topRadius, const ScalarType height, const ScalarType sweepDegrees, const GfMatrix4d *framePtr=nullptr)
 
- Static Public Member Functions inherited from GeomUtilMeshGeneratorBase
template<typename PointIterType , typename Enabled = typename _EnableIfNotGfVec3Iterator<PointIterType>::type>
static void GeneratePoints (PointIterType iter,...)
 
template<typename PointIterType , typename Enabled = typename _EnableIfNotGfVec3Iterator<PointIterType>::type>
static void GenerateNormals (PointIterType iter,...)
 

Static Public Attributes

static constexpr size_t minNumRadial = 3
 
static constexpr size_t minNumCapAxial = 1
 

Additional Inherited Members

- Protected Types inherited from GeomUtilMeshGeneratorBase
enum  _CapStyle { CapStyleNone, CapStyleSharedEdge, CapStyleSeparateEdge }
 
- Static Protected Member Functions inherited from GeomUtilMeshGeneratorBase
static PxOsdMeshTopology _GenerateCappedQuadTopology (const size_t numRadial, const size_t numQuadStrips, const _CapStyle bottomCapStyle, const _CapStyle topCapStyle, const bool closedSweep)
 
static size_t _ComputeNumRadialPoints (const size_t numRadial, const bool closedSweep)
 
static size_t _ComputeNumCappedQuadTopologyPoints (const size_t numRadial, const size_t numQuadStrips, const _CapStyle bottomCapStyle, const _CapStyle topCapStyle, const bool closedSweep)
 
template<typename ScalarType >
static std::vector< std::array
< ScalarType, 2 > > 
_GenerateUnitArcXY (const size_t numRadial, const ScalarType sweepDegrees)
 

Detailed Description

This class provides an implementation for generating topology, point positions and surface normals on a capsule. The simplest form takes a radius and height and is a cylinder capped by two hemispheres that is centered at the origin. The generated capsule is made up of circular cross-sections in the XY plane. Each cross-section has numRadial segments. Successive cross- sections for each of the hemispheres are generated at numCapAxial locations along the Z and -Z axes respectively. The height is aligned with the Z axis and represents the height of just the cylindrical portion.

An optional transform may be provided to GeneratePoints and GenerateNormals to orient the capsule as necessary (e.g., whose height is aligned with the Y axis).

An additional overload of GeneratePoints is provided to specify different radii and heights for the bottom and top caps, as well as the sweep angle for the capsule about the +Z axis. When the sweep is less than 360 degrees, the generated geometry is not closed.

When the radii are different, the numCapAxial parameter is doubled and the number of cross-sections will be divided between the top and bottom hemispheres relative to the angle that each portion uses. The topology will remain the same while the density of the mesh is more even than if the bottom and top caps used the same number of cross-sections.

Usage:

const size_t numRadial = 4, numCapAxial = 4;
const size_t numPoints =
const float radius = 1, height = 2;
MyPointContainer<GfVec3f> points(numPoints);
points.begin(), numRadial, numCapAxial, radius, height);
const size_t numNormals =
MyPointContainer<GfVec3f> normals(numNormals);
normals.begin(), numRadial, numCapAxial, radius, height);

Definition at line 68 of file capsuleMeshGenerator.h.

Member Function Documentation

static size_t GeomUtilCapsuleMeshGenerator::ComputeNumNormals ( const size_t  numRadial,
const size_t  numCapAxial,
const bool  closedSweep = true 
)
inlinestatic

Definition at line 81 of file capsuleMeshGenerator.h.

static GEOMUTIL_API size_t GeomUtilCapsuleMeshGenerator::ComputeNumPoints ( const size_t  numRadial,
const size_t  numCapAxial,
const bool  closedSweep = true 
)
static
template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GenerateNormals ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  radius,
const ScalarType  height,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 170 of file capsuleMeshGenerator.h.

template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GenerateNormals ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  bottomRadius,
const ScalarType  topRadius,
const ScalarType  height,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 188 of file capsuleMeshGenerator.h.

template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GenerateNormals ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  bottomRadius,
const ScalarType  topRadius,
const ScalarType  height,
const ScalarType  sweepDegrees,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 208 of file capsuleMeshGenerator.h.

template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GeneratePoints ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  radius,
const ScalarType  height,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 106 of file capsuleMeshGenerator.h.

template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GeneratePoints ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  bottomRadius,
const ScalarType  topRadius,
const ScalarType  height,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 124 of file capsuleMeshGenerator.h.

template<typename PointIterType , typename ScalarType , typename Enabled = typename _EnableIfGfVec3Iterator<PointIterType>::type>
static void GeomUtilCapsuleMeshGenerator::GeneratePoints ( PointIterType  iter,
const size_t  numRadial,
const size_t  numCapAxial,
const ScalarType  bottomRadius,
const ScalarType  topRadius,
const ScalarType  height,
const ScalarType  sweepDegrees,
const GfMatrix4d framePtr = nullptr 
)
inlinestatic

Definition at line 144 of file capsuleMeshGenerator.h.

static GEOMUTIL_API PxOsdMeshTopology GeomUtilCapsuleMeshGenerator::GenerateTopology ( const size_t  numRadial,
const size_t  numCapAxial,
const bool  closedSweep = true 
)
static
static TfToken GeomUtilCapsuleMeshGenerator::GetNormalsInterpolation ( )
inlinestatic

Definition at line 90 of file capsuleMeshGenerator.h.

Member Data Documentation

constexpr size_t GeomUtilCapsuleMeshGenerator::minNumCapAxial = 1
static

Definition at line 73 of file capsuleMeshGenerator.h.

constexpr size_t GeomUtilCapsuleMeshGenerator::minNumRadial = 3
static

Definition at line 72 of file capsuleMeshGenerator.h.


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