# GeomUtil module

Summary: The GeomUtil module contains utilities to help image common geometry.

Utilities to help image common geometry.

Classes:

 `CapsuleMeshGenerator` This class provides an implementation for generating topology and point positions on a capsule. `ConeMeshGenerator` This class provides an implementation for generating topology and point positions on a cone of a given radius and height. `CuboidMeshGenerator` This class provides an implementation for generating topology and point positions on a rectangular cuboid given the dimensions along the X, Y and Z axes. `CylinderMeshGenerator` This class provides an implementation for generating topology and point positions on a cylinder with a given radius and height. `SphereMeshGenerator` This class provides an implementation for generating topology and point positions on a sphere with a given radius.
class pxr.GeomUtil.CapsuleMeshGenerator

This class provides an implementation for generating topology and point positions 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 to orient the capsule as necessary (e.g., whose height is along 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.

Usage:

```const size_t numRadial = 4, numCapAxial = 4;
const size_t numPoints =
const float radius = 1, height = 2;

MyPointContainer<GfVec3f> points(numPoints);

GeomUtilCapsuleMeshGenerator::GeneratePoints(
```

Methods:

 `ComputeNumPoints` classmethod ComputeNumPoints(numRadial, numCapAxial, closedSweep) -> int `GeneratePoints` classmethod GeneratePoints(iter, numRadial, numCapAxial, radius, height, framePtr) -> None `GenerateTopology` classmethod GenerateTopology(numRadial, numCapAxial, closedSweep) -> MeshTopology

Attributes:

static ComputeNumPoints()

classmethod ComputeNumPoints(numRadial, numCapAxial, closedSweep) -> int

Parameters

• numCapAxial (int) –

• closedSweep (bool) –

static GeneratePoints()

Parameters
• iter (PointIterType) –

• numCapAxial (int) –

• height (ScalarType) –

• framePtr (Matrix4d) –

Parameters
• iter (PointIterType) –

• numCapAxial (int) –

• height (ScalarType) –

• bottomCapHeight (ScalarType) –

• topCapHeight (ScalarType) –

• sweepDegrees (ScalarType) –

• framePtr (Matrix4d) –

GeneratePoints(iter, arg2) -> None

Parameters
• iter (PointIterType) –

• arg2

static GenerateTopology()

classmethod GenerateTopology(numRadial, numCapAxial, closedSweep) -> MeshTopology

Parameters

• numCapAxial (int) –

• closedSweep (bool) –

minNumCapAxial = 1
class pxr.GeomUtil.ConeMeshGenerator

This class provides an implementation for generating topology and point positions on a cone of a given radius and height.

The cone is made up of circular cross-sections in the XY plane and is centered at the origin. Each cross-section has numRadial segments. The height is aligned with the Z axis, with the base of the object at Z = -h/2 and apex at Z = h/2.

An optional transform may be provided to GeneratePoints to orient the cone as necessary (e.g., whose height is along the Y axis).

An additional overload of GeneratePoints is provided to specify the sweep angle for the cone about the +Z axis. When the sweep is less than 360 degrees, the generated geometry is not closed.

Usage:

```const size_t numRadial = 8;
const size_t numPoints =
const float radius = 1, height = 2;

MyPointContainer<GfVec3f> points(numPoints);

GeomUtilConeMeshGenerator::GeneratePoints(
```

Methods:

 `ComputeNumPoints` classmethod ComputeNumPoints(numRadial, closedSweep) -> int `GeneratePoints` classmethod GeneratePoints(iter, numRadial, radius, height, framePtr) -> None `GenerateTopology` classmethod GenerateTopology(numRadial, closedSweep) -> MeshTopology

Attributes:

static ComputeNumPoints()

Parameters

• closedSweep (bool) –

static GeneratePoints()

Parameters
• iter (PointIterType) –

• height (ScalarType) –

• framePtr (Matrix4d) –

Parameters
• iter (PointIterType) –

• height (ScalarType) –

• sweepDegrees (ScalarType) –

• framePtr (Matrix4d) –

GeneratePoints(iter, arg2) -> None

Parameters
• iter (PointIterType) –

• arg2

static GenerateTopology()

Parameters

• closedSweep (bool) –

class pxr.GeomUtil.CuboidMeshGenerator

This class provides an implementation for generating topology and point positions on a rectangular cuboid given the dimensions along the X, Y and Z axes.

The generated cuboid is centered at the origin.

An optional transform may be provided to GeneratePoints to orient the cuboid as necessary.

Usage:

```const size_t numPoints =
GeomUtilCuboidMeshGenerator::ComputeNumPoints();
const float l = 5, b = 4, h = 3;

MyPointContainer<GfVec3f> points(numPoints);

GeomUtilCuboidMeshGenerator::GeneratePoints(
points.begin(), l, b, h);
```

Methods:

 `ComputeNumPoints` classmethod ComputeNumPoints() -> int `GeneratePoints` classmethod GeneratePoints(iter, xLength, yLength, zLength, framePtr) -> None `GenerateTopology` classmethod GenerateTopology() -> MeshTopology
static ComputeNumPoints()

classmethod ComputeNumPoints() -> int

static GeneratePoints()

classmethod GeneratePoints(iter, xLength, yLength, zLength, framePtr) -> None

Parameters
• iter (PointIterType) –

• xLength (ScalarType) –

• yLength (ScalarType) –

• zLength (ScalarType) –

• framePtr (Matrix4d) –

GeneratePoints(iter, arg2) -> None

Parameters
• iter (PointIterType) –

• arg2

static GenerateTopology()

classmethod GenerateTopology() -> MeshTopology

class pxr.GeomUtil.CylinderMeshGenerator

This class provides an implementation for generating topology and point positions on a cylinder with a given radius and height.

The cylinder is made up of circular cross-sections in the XY plane and is centered at the origin. Each cross-section has numRadial segments. The height is aligned with the Z axis, with the base at Z = -h/2.

An optional transform may be provided to GeneratePoints to orient the cone as necessary (e.g., whose height is along the Y axis).

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

Setting one radius to 0 in order to get a cone is inefficient and could result in artifacts. Clients should use GeomUtilConeMeshGenerator instead. Usage:

```const size_t numRadial = 8;
const size_t numPoints =
const float radius = 1, height = 2;

MyPointContainer<GfVec3f> points(numPoints);

GeomUtilCylinderMeshGenerator::GeneratePoints(
```

Methods:

 `ComputeNumPoints` classmethod ComputeNumPoints(numRadial, closedSweep) -> int `GeneratePoints` classmethod GeneratePoints(iter, numRadial, radius, height, framePtr) -> None `GenerateTopology` classmethod GenerateTopology(numRadial, closedSweep) -> MeshTopology

Attributes:

static ComputeNumPoints()

Parameters

• closedSweep (bool) –

static GeneratePoints()

Parameters
• iter (PointIterType) –

• height (ScalarType) –

• framePtr (Matrix4d) –

Parameters
• iter (PointIterType) –

• height (ScalarType) –

• sweepDegrees (ScalarType) –

• framePtr (Matrix4d) –

GeneratePoints(iter, arg2) -> None

Parameters
• iter (PointIterType) –

• arg2

static GenerateTopology()

Parameters

• closedSweep (bool) –

class pxr.GeomUtil.SphereMeshGenerator

This class provides an implementation for generating topology and point positions on a sphere with a given radius.

The sphere is made up of circular cross-sections in the XY plane and is centered at the origin. Each cross-section has numRadial segments. Successive cross-sections are generated at numAxial locations along the Z axis, with the bottom of the sphere at Z = -r and top at Z = r.

An optional transform may be provided to GeneratePoints to orient the sphere as necessary (e.g., cross-sections in the YZ plane).

An additional overload of GeneratePoints is provided to specify a sweep angle for the sphere about the +Z axis. When the sweep is less than 360 degrees, the generated geometry is not closed.

Usage:

```const size_t numRadial = 4, numAxial = 4;
const size_t numPoints =

MyPointContainer<GfVec3f> points(numPoints);

GeomUtilSphereMeshGenerator::GeneratePoints(
```

Methods:

 `ComputeNumPoints` classmethod ComputeNumPoints(numRadial, numAxial, closedSweep) -> int `GeneratePoints` classmethod GeneratePoints(iter, numRadial, numAxial, radius, framePtr) -> None `GenerateTopology` classmethod GenerateTopology(numRadial, numAxial, closedSweep) -> MeshTopology

Attributes:

static ComputeNumPoints()

classmethod ComputeNumPoints(numRadial, numAxial, closedSweep) -> int

Parameters

• numAxial (int) –

• closedSweep (bool) –

static GeneratePoints()

Parameters
• iter (PointIterType) –

• numAxial (int) –

• framePtr (Matrix4d) –

Parameters
• iter (PointIterType) –

• numAxial (int) –

• sweepDegrees (ScalarType) –

• framePtr (Matrix4d) –

GeneratePoints(iter, arg2) -> None

Parameters
• iter (PointIterType) –

• arg2

static GenerateTopology()

classmethod GenerateTopology(numRadial, numAxial, closedSweep) -> MeshTopology

Parameters