18 template <
typename Real>
20 OrientedBox2<Real>& box);
25 template <
typename Real>
26 bool InContainer(Vector2<Real>
const& point, OrientedBox2<Real>
const& box);
31 template <
typename Real>
33 OrientedBox2<Real>
const& box1, OrientedBox2<Real>& merge);
36 template <
typename Real>
42 if (fitter.
Fit(numPoints, points))
55 for (
int i = 1; i < numPoints; ++i)
57 diff = points[i] - box.
center;
58 for (
int j = 0; j < 2; ++j)
60 Real dot =
Dot(diff, box.
axis[j]);
65 else if (dot > pmax[j])
72 for (
int j = 0; j < 2; ++j)
74 box.
center += (((Real)0.5)*(pmin[j] + pmax[j]))*box.
axis[j];
75 box.
extent[j] = ((Real)0.5)*(pmax[j] - pmin[j]);
83 template <
typename Real>
87 for (
int i = 0; i < 2; ++i)
89 Real coeff =
Dot(diff, box.
axis[i]);
98 template <
typename Real>
112 merge.
axis[0] = ((Real)0.5)*(box0.
axis[0] + box1.
axis[0]);
116 merge.
axis[0] = ((Real)0.5)*(box0.
axis[0] - box1.
axis[0]);
132 std::array<Vector2<Real>, 4> vertex;
137 for (
int i = 0; i < 4; ++i)
140 for (
int j = 0; j < 2; ++j)
142 Real dot =
Dot(diff, merge.
axis[j]);
147 else if (dot < pmin[j])
155 for (
int i = 0; i < 4; ++i)
158 for (
int j = 0; j < 2; ++j)
160 Real dot =
Dot(diff, merge.
axis[j]);
165 else if (dot < pmin[j])
175 Real
const half = (Real)0.5;
176 for (
int j = 0; j < 2; ++j)
178 merge.
center += half*(pmax[j] + pmin[j])*merge.
axis[j];
179 merge.
extent[j] = half*(pmax[j] - pmin[j]);
std::array< Vector< N, Real >, N > axis
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
bool GetContainer(int numPoints, Vector3< Real > const *points, Capsule3< Real > &capsule)
bool Fit(int numPoints, Vector2< Real > const *points)
OrientedBox2< Real > const & GetParameters() const
bool MergeContainers(Capsule3< Real > const &capsule0, Capsule3< Real > const &capsule1, Capsule3< Real > &merge)
bool InContainer(Vector3< Real > const &point, Capsule3< Real > const &capsule)
GLfixed GLfixed GLint GLint GLfixed points
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real Normalize(GVector< Real > &v, bool robust=false)
Vector2< Real > Perp(Vector2< Real > const &v)
void GetVertices(std::array< Vector< N, Real >,(1<< N)> &vertex) const