21 template <
typename Real,
typename ComputeType>
41 template <
typename Real,
typename ComputeType>
48 ch0(numPoints0, points0, (Real)0);
56 ch1(numPoints1, points1, (Real)0);
64 int numTriangles0 =
static_cast<int>(hull0.size());
65 int const* indices0 =
reinterpret_cast<int const*
>(&hull0[0]);
66 int numTriangles1 =
static_cast<int>(hull1.size());
67 int const* indices1 =
reinterpret_cast<int const*
>(&hull1[0]);
70 int i, i0, i1, i2, side0, side1;
72 for (i = 0; i < numTriangles0; ++i)
76 i1 = indices0[3 * i + 1];
77 i2 = indices0[3 * i + 2];
80 separatingPlane =
Plane3<Real>({ points0[i0], points0[i1],
84 side1 =
OnSameSide(separatingPlane, numTriangles1, indices1, points1);
89 side0 =
WhichSide(separatingPlane, numTriangles0, indices0,
99 for (i = 0; i < numTriangles1; ++i)
102 i0 = indices1[3 * i];
103 i1 = indices1[3 * i + 1];
104 i2 = indices1[3 * i + 2];
107 separatingPlane =
Plane3<Real>({ points1[i0], points1[i1],
111 side0 =
OnSameSide(separatingPlane, numTriangles0, indices0, points0);
115 side1 =
WhichSide(separatingPlane, numTriangles1, indices1,
117 if (side0*side1 <= 0)
125 std::set<std::pair<int, int>> edgeSet0;
126 for (i = 0; i < numTriangles0; ++i)
129 i0 = indices0[3 * i];
130 i1 = indices0[3 * i + 1];
131 i2 = indices0[3 * i + 2];
132 edgeSet0.insert(std::make_pair(i0, i1));
133 edgeSet0.insert(std::make_pair(i0, i2));
134 edgeSet0.insert(std::make_pair(i1, i2));
138 std::set<std::pair<int, int>> edgeSet1;
139 for (i = 0; i < numTriangles1; ++i)
142 i0 = indices1[3 * i];
143 i1 = indices1[3 * i + 1];
144 i2 = indices1[3 * i + 2];
145 edgeSet1.insert(std::make_pair(i0, i1));
146 edgeSet1.insert(std::make_pair(i0, i2));
147 edgeSet1.insert(std::make_pair(i1, i2));
152 for (
auto const& e0 : edgeSet0)
155 diff0 = points0[e0.second] - points0[e0.first];
157 for (
auto const& e1 : edgeSet1)
159 diff1 = points1[e1.second] - points1[e1.first];
167 side0 =
OnSameSide(separatingPlane, numTriangles0, indices0,
169 side1 =
OnSameSide(separatingPlane, numTriangles1, indices1,
182 template <
typename Real,
typename ComputeType>
187 int posSide = 0, negSide = 0;
189 for (
int t = 0;
t < numTriangles; ++
t)
191 for (
int i = 0; i < 3; ++i)
193 int v = indices[3 *
t + i];
204 if (posSide && negSide)
212 return (posSide ? +1 : -1);
215 template <
typename Real,
typename ComputeType>
220 for (
int t = 0;
t < numTriangles; ++
t)
222 for (
int i = 0; i < 3; ++i)
224 int v = indices[3 *
t + i];
std::vector< TriangleKey< true > > const & GetHullUnordered() const
int OnSameSide(Plane3< Real > const &plane, int numTriangles, int const *indices, Vector3< Real > const *points) const
Vector< N, Real > UnitCross(Vector< N, Real > const &v0, Vector< N, Real > const &v1, bool robust=false)
int WhichSide(Plane3< Real > const &plane, int numTriangles, int const *indices, Vector3< Real > const *points) const
GLfixed GLfixed GLint GLint GLfixed points
GLsizei GLenum const void * indices
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
bool operator()(int numPoints0, Vector3< Real > const *points0, int numPoints1, Vector3< Real > const *points1, Plane3< Real > &separatingPlane) const