39 template <
typename Real>
51 int numIndices,
int const*
indices,
bool counterClockwise);
56 inline operator bool()
const;
59 inline std::shared_ptr<std::vector<Vector3<Real>>>
const&
GetVertexPool()
const;
60 inline std::vector<Vector3<Real>>
const&
GetVertices()
const;
62 inline std::vector<int>
const&
GetIndices()
const;
78 template <
typename Real>
80 int numIndices,
int const*
indices,
bool counterClockwise)
85 if (vertexPool && indices && numIndices >= 12 && (numIndices % 3) == 0)
87 for (
int i = 0; i < numIndices; ++i)
93 std::copy(indices, indices + numIndices,
mIndices.begin());
103 template <
typename Real>
inline 109 template <
typename Real>
inline 115 template <
typename Real>
inline 121 template <
typename Real>
inline 127 template <
typename Real>
inline 133 template <
typename Real>
inline 139 template <
typename Real>
148 average += vertexPool[
index];
150 average /=
static_cast<Real
>(mUniqueIndices.size());
155 template <
typename Real>
158 Real surfaceArea = (Real)0;
162 int const numTriangles =
static_cast<int>(
mIndices.size()) / 3;
164 for (
int t = 0;
t < numTriangles; ++
t)
172 surfaceArea +=
Length(cross);
174 surfaceArea *= (Real)0.5;
179 template <
typename Real>
182 Real volume = (Real)0;
186 int const numTriangles =
static_cast<int>(
mIndices.size()) / 3;
188 for (
int t = 0;
t < numTriangles; ++
t)
193 volume +=
DotCross(vertexPool[v0], vertexPool[v1], vertexPool[v2]);
std::vector< Vector3< Real > > const & GetVertices() const
std::vector< int > const & GetIndices() const
Polyhedron3(std::shared_ptr< std::vector< Vector3< Real >>> const &vertexPool, int numIndices, int const *indices, bool counterClockwise)
bool CounterClockwise() const
std::set< int > mUniqueIndices
Real ComputeSurfaceArea() const
Real ComputeVolume() const
GLsizei GLenum const void * indices
Vector3< Real > ComputeVertexAverage() const
std::set< int > const & GetUniqueIndices() const
DualQuaternion< Real > Cross(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real DotCross(Vector< N, Real > const &v0, Vector< N, Real > const &v1, Vector< N, Real > const &v2)
std::shared_ptr< std::vector< Vector3< Real > > > mVertexPool
DualQuaternion< Real > Length(DualQuaternion< Real > const &d, bool robust=false)
GLfloat GLfloat GLfloat v2
std::shared_ptr< std::vector< Vector3< Real > > > const & GetVertexPool() const
std::vector< int > mIndices