Loading...
Searching...
No Matches
cylinderMeshGenerator.h
1//
2// Copyright 2022 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_GEOM_UTIL_CYLINDER_MESH_GENERATOR_H
8#define PXR_IMAGING_GEOM_UTIL_CYLINDER_MESH_GENERATOR_H
9
10#include "pxr/imaging/geomUtil/api.h"
11#include "pxr/imaging/geomUtil/meshGeneratorBase.h"
12
13#include "pxr/pxr.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17class GfMatrix4d;
19
55{
56public:
57 static constexpr size_t minNumRadial = 3;
58
59 GEOMUTIL_API
60 static size_t ComputeNumPoints(
61 const size_t numRadial,
62 const bool closedSweep = true);
63
64 GEOMUTIL_API
65 static PxOsdMeshTopology GenerateTopology(
66 const size_t numRadial,
67 const bool closedSweep = true);
68
69 template<typename PointIterType,
70 typename ScalarType,
71 typename Enabled =
72 typename _EnableIfGfVec3Iterator<PointIterType>::type>
73 static void GeneratePoints(
74 PointIterType iter,
75 const size_t numRadial,
76 const ScalarType radius,
77 const ScalarType height,
78 const GfMatrix4d* framePtr = nullptr)
79 {
80 constexpr ScalarType sweep = 360;
81
82 GeneratePoints(iter, numRadial,
83 /* bottomRadius = */ radius,
84 /* topRadius = */ radius,
85 height, sweep, framePtr);
86 }
87
88 template<typename PointIterType,
89 typename ScalarType,
90 typename Enabled =
91 typename _EnableIfGfVec3Iterator<PointIterType>::type>
92 static void GeneratePoints(
93 PointIterType iter,
94 const size_t numRadial,
95 const ScalarType bottomRadius,
96 const ScalarType topRadius,
97 const ScalarType height,
98 const ScalarType sweepDegrees,
99 const GfMatrix4d* framePtr = nullptr)
100 {
101 using PointType =
102 typename std::iterator_traits<PointIterType>::value_type;
103
104 _GeneratePointsImpl(numRadial, bottomRadius, topRadius, height,
105 sweepDegrees,
106 framePtr ? _PointWriter<PointType>(iter, framePtr)
107 : _PointWriter<PointType>(iter));
108 }
109
110 using GeomUtilMeshGeneratorBase::GeneratePoints;
111
112private:
113
114 template<typename PointType>
115 static void _GeneratePointsImpl(
116 const size_t numRadial,
117 const typename PointType::ScalarType bottomRadius,
118 const typename PointType::ScalarType topRadius,
119 const typename PointType::ScalarType height,
120 const typename PointType::ScalarType sweep,
121 const _PointWriter<PointType>& ptWriter);
122};
123
124PXR_NAMESPACE_CLOSE_SCOPE
125
126#endif // PXR_IMAGING_GEOM_UTIL_CYLINDER_MESH_GENERATOR_H
This class provides an implementation for generating topology and point positions on a cylinder with ...
This class provides common implementation for the different mesh generator classes in GeomUtil.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Topology data for meshes.
Definition: meshTopology.h:52