7#ifndef PXR_IMAGING_GEOM_UTIL_CAPSULE_MESH_GENERATOR_H
8#define PXR_IMAGING_GEOM_UTIL_CAPSULE_MESH_GENERATOR_H
10#include "pxr/imaging/geomUtil/api.h"
11#include "pxr/imaging/geomUtil/meshGeneratorBase.h"
16PXR_NAMESPACE_OPEN_SCOPE
72 static constexpr size_t minNumRadial = 3;
73 static constexpr size_t minNumCapAxial = 1;
76 static size_t ComputeNumPoints(
77 const size_t numRadial,
78 const size_t numCapAxial,
79 const bool closedSweep =
true);
81 static size_t ComputeNumNormals(
82 const size_t numRadial,
83 const size_t numCapAxial,
84 const bool closedSweep =
true)
87 return ComputeNumPoints(numRadial, numCapAxial, closedSweep);
90 static TfToken GetNormalsInterpolation()
93 return GeomUtilInterpolationTokens->vertex;
98 const size_t numRadial,
99 const size_t numCapAxial,
100 const bool closedSweep =
true);
102 template<
typename PointIterType,
105 typename _EnableIfGfVec3Iterator<PointIterType>::type>
106 static void GeneratePoints(
108 const size_t numRadial,
109 const size_t numCapAxial,
110 const ScalarType radius,
111 const ScalarType height,
114 GeneratePoints(iter, numRadial, numCapAxial,
120 template<
typename PointIterType,
123 typename _EnableIfGfVec3Iterator<PointIterType>::type>
124 static void GeneratePoints(
126 const size_t numRadial,
127 const size_t numCapAxial,
128 const ScalarType bottomRadius,
129 const ScalarType topRadius,
130 const ScalarType height,
133 constexpr ScalarType sweep = 360;
135 GeneratePoints(iter, numRadial, numCapAxial,
136 bottomRadius, topRadius,
137 height, sweep, framePtr);
140 template<
typename PointIterType,
143 typename _EnableIfGfVec3Iterator<PointIterType>::type>
144 static void GeneratePoints(
146 const size_t numRadial,
147 const size_t numCapAxial,
148 const ScalarType bottomRadius,
149 const ScalarType topRadius,
150 const ScalarType height,
151 const ScalarType sweepDegrees,
155 typename std::iterator_traits<PointIterType>::value_type;
157 _GeneratePointsImpl(numRadial, numCapAxial, bottomRadius, topRadius,
158 height, sweepDegrees,
159 framePtr ? _PointWriter<PointType>(iter, framePtr)
160 : _PointWriter<PointType>(iter));
163 using GeomUtilMeshGeneratorBase::GeneratePoints;
166 template<
typename PointIterType,
169 typename _EnableIfGfVec3Iterator<PointIterType>::type>
170 static void GenerateNormals(
172 const size_t numRadial,
173 const size_t numCapAxial,
174 const ScalarType radius,
175 const ScalarType height,
178 GenerateNormals(iter, numRadial, numCapAxial,
184 template<
typename PointIterType,
187 typename _EnableIfGfVec3Iterator<PointIterType>::type>
188 static void GenerateNormals(
190 const size_t numRadial,
191 const size_t numCapAxial,
192 const ScalarType bottomRadius,
193 const ScalarType topRadius,
194 const ScalarType height,
197 constexpr ScalarType sweep = 360;
199 GenerateNormals(iter, numRadial, numCapAxial,
200 bottomRadius, topRadius,
201 height, sweep, framePtr);
204 template<
typename PointIterType,
207 typename _EnableIfGfVec3Iterator<PointIterType>::type>
208 static void GenerateNormals(
210 const size_t numRadial,
211 const size_t numCapAxial,
212 const ScalarType bottomRadius,
213 const ScalarType topRadius,
214 const ScalarType height,
215 const ScalarType sweepDegrees,
219 typename std::iterator_traits<PointIterType>::value_type;
221 _GenerateNormalsImpl(numRadial, numCapAxial, bottomRadius, topRadius,
222 height, sweepDegrees,
223 framePtr ? _PointWriter<PointType>(iter, framePtr)
224 : _PointWriter<PointType>(iter));
227 using GeomUtilMeshGeneratorBase::GenerateNormals;
231 template<
typename ScalarType>
232 static size_t _ComputeNumBottomCapAxial(
233 const size_t numCapAxial,
234 const ScalarType latitudeRange);
236 static size_t _ComputeNumTopCapAxial(
237 const size_t numCapAxial,
238 const size_t numBottomCapAxial);
240 template<
typename Po
intType>
241 static void _GeneratePointsImpl(
242 const size_t numRadial,
243 const size_t numCapAxial,
244 const typename PointType::ScalarType bottomRadius,
245 const typename PointType::ScalarType topRadius,
246 const typename PointType::ScalarType height,
247 const typename PointType::ScalarType sweep,
248 const _PointWriter<PointType>& ptWriter);
250 template<
typename Po
intType>
251 static void _GenerateNormalsImpl(
252 const size_t numRadial,
253 const size_t numCapAxial,
254 const typename PointType::ScalarType bottomRadius,
255 const typename PointType::ScalarType topRadius,
256 const typename PointType::ScalarType height,
257 const typename PointType::ScalarType sweep,
258 const _PointWriter<PointType>& ptWriter);
261PXR_NAMESPACE_CLOSE_SCOPE
This class provides an implementation for generating topology, point positions and surface normals on...
This class provides common implementation for the different mesh generator classes in GeomUtil.
Stores a 4x4 matrix of double elements.
Topology data for meshes.
Token for efficient comparison, assignment, and hashing of known strings.