41 template <
typename InputType,
typename ComputeType>
115 template <
typename InputType,
typename ComputeType>
129 template <
typename InputType,
typename ComputeType>
133 mEpsilon = std::max(epsilon, (InputType)0);
138 mPlane.constant = (InputType)0;
183 for (j = 0; j < 3; ++j)
208 std::set<Vector3<InputType>> processed;
209 for (i = 0; i < 4; ++i)
211 processed.insert(points[info.
extreme[i]]);
215 if (processed.find(points[i]) == processed.end())
218 processed.insert(points[i]);
225 template <
typename InputType,
typename ComputeType>
inline 231 template <
typename InputType,
typename ComputeType>
inline 237 template <
typename InputType,
typename ComputeType>
inline 243 template <
typename InputType,
typename ComputeType>
inline 249 template <
typename InputType,
typename ComputeType>
inline 255 template <
typename InputType,
typename ComputeType>
inline 261 template <
typename InputType,
typename ComputeType>
inline 267 template <
typename InputType,
typename ComputeType>
inline 273 template <
typename InputType,
typename ComputeType>
inline 279 template <
typename InputType,
typename ComputeType>
294 template <
typename InputType,
typename ComputeType>
319 unsigned int numFaces =
static_cast<unsigned int>(
mHullUnordered.size());
320 std::vector<int> queryResult(numFaces);
324 unsigned int numFacesPerThread = numFaces /
mNumThreads;
328 jmin[
t] =
t * numFacesPerThread;
329 jmax[
t] = jmin[
t] + numFacesPerThread - 1;
331 jmax[mNumThreads - 1] = numFaces - 1;
334 std::vector<std::thread> process(mNumThreads);
337 process[
t] = std::thread([
this, i,
t, &jmin, &jmax,
340 for (
unsigned int j = jmin[
t]; j <= jmax[
t]; ++j)
359 queryResult[j++] =
mQuery.
ToPlane(i, tri.V[0], tri.V[1], tri.V[2]);
363 std::map<EdgeKey<false>, std::pair<int, int>> terminator;
364 std::vector<TriangleKey<true>> backFaces;
365 bool existsFrontFacingTriangle =
false;
369 if (queryResult[j++] <= 0)
373 backFaces.push_back(tri);
383 for (
int j0 = 2, j1 = 0; j1 < 3; j0 = j1++)
385 int v0 = tri.V[j0],
v1 = tri.V[j1];
387 auto iter = terminator.find(edge);
388 if (iter == terminator.end())
391 terminator.insert(std::make_pair(edge, std::make_pair(v0,
v1)));
396 terminator.erase(edge);
406 existsFrontFacingTriangle =
true;
410 if (!existsFrontFacingTriangle)
419 mHullUnordered = backFaces;
423 for (
auto const& edge : terminator)
425 mHullUnordered.push_back(
TriangleKey<true>(i, edge.second.second, edge.second.first));
bool operator()(int numPoints, Vector3< InputType > const *points, InputType epsilon)
Line3< InputType > const & GetLine() const
ConvexHull3(unsigned int numThreads=1)
std::vector< TriangleKey< true > > const & GetHullUnordered() const
int ToPlane(int i, int v0, int v1, int v2) const
int GetNumUniquePoints() const
std::vector< Vector3< ComputeType > > mComputePoints
PrimalQuery3< ComputeType > const & GetQuery() const
std::vector< TriangleKey< true > > mHullUnordered
Vector< N, Real > UnitCross(Vector< N, Real > const &v0, Vector< N, Real > const &v1, bool robust=false)
PrimalQuery3< ComputeType > mQuery
GLfixed GLfixed GLint GLint GLfixed points
Plane3< InputType > mPlane
virtual std::shared_ptr< Triangle > Insert(int v0, int v1, int v2)
Vector3< Real > direction[3]
InputType GetEpsilon() const
ETManifoldMesh const & GetHullMesh() const
void Set(int numVertices, Vector3< Real > const *vertices)
TMap const & GetTriangles() const
Vector3< InputType > const * GetPoints() const
Plane3< InputType > const & GetPlane() const
Vector3< InputType > const * mPoints