Loading...
Searching...
No Matches
coneMeshGenerator.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_CONE_MESH_GENERATOR_H
8#define PXR_IMAGING_GEOM_UTIL_CONE_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
50{
51public:
52 static constexpr size_t minNumRadial = 3;
53
54 GEOMUTIL_API
55 static size_t ComputeNumPoints(
56 const size_t numRadial,
57 const bool closedSweep = true);
58
59 GEOMUTIL_API
60 static PxOsdMeshTopology GenerateTopology(
61 const size_t numRadial,
62 const bool closedSweep = true);
63
64 template<typename PointIterType,
65 typename ScalarType,
66 typename Enabled =
67 typename _EnableIfGfVec3Iterator<PointIterType>::type>
68 static void GeneratePoints(
69 PointIterType iter,
70 const size_t numRadial,
71 const ScalarType radius,
72 const ScalarType height,
73 const GfMatrix4d* framePtr = nullptr)
74 {
75 constexpr ScalarType sweep = 360;
76 GeneratePoints(iter, numRadial, radius, height, sweep, framePtr);
77 }
78
79 template<typename PointIterType,
80 typename ScalarType,
81 typename Enabled =
82 typename _EnableIfGfVec3Iterator<PointIterType>::type>
83 static void GeneratePoints(
84 PointIterType iter,
85 const size_t numRadial,
86 const ScalarType radius,
87 const ScalarType height,
88 const ScalarType sweepDegrees,
89 const GfMatrix4d* framePtr = nullptr)
90 {
91 using PointType =
92 typename std::iterator_traits<PointIterType>::value_type;
93
94 _GeneratePointsImpl(numRadial, radius, height, sweepDegrees,
95 framePtr ? _PointWriter<PointType>(iter, framePtr)
96 : _PointWriter<PointType>(iter));
97 }
98
99 using GeomUtilMeshGeneratorBase::GeneratePoints;
100
101private:
102
103 template<typename PointType>
104 static void _GeneratePointsImpl(
105 const size_t numRadial,
106 const typename PointType::ScalarType radius,
107 const typename PointType::ScalarType height,
108 const typename PointType::ScalarType sweepDegrees,
109 const _PointWriter<PointType>& ptWriter);
110};
111
112PXR_NAMESPACE_CLOSE_SCOPE
113
114#endif // PXR_IMAGING_GEOM_UTIL_CONE_MESH_GENERATOR_H
This class provides an implementation for generating topology and point positions on a cone of a give...
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