15 #ifndef INCLUDED_IMATHFRUSTUMTEST_H
16 #define INCLUDED_IMATHFRUSTUMTEST_H
27 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
97 setFrustum (frust, cameraMat);
103 setFrustum (frustum, cameraMat);
130 bool isVisible (const
Vec3<
T>& vec) const IMATH_NOEXCEPT;
134 bool completelyContains (const
Sphere3<
T>& sphere) const IMATH_NOEXCEPT;
138 bool completelyContains (const
Box<
Vec3<
T>>& box) const IMATH_NOEXCEPT;
178 frustum.planes (frustumPlanes, cameraMat);
182 for (
int i = 0; i < 2; ++i)
187 frustumPlanes[index + 1].
normal.x,
188 frustumPlanes[index + 2].
normal.x);
190 frustumPlanes[index + 1].
normal.y,
191 frustumPlanes[index + 2].
normal.y);
193 frustumPlanes[index + 1].
normal.z,
194 frustumPlanes[index + 2].
normal.z);
210 currFrustum = frustum;
211 cameraMatrix = cameraMat;
214 template <
typename T>
219 Vec3<T> radiusVec =
Vec3<T> (sphere.radius, sphere.radius, sphere.radius);
222 Vec3<T> d0 = planeNormX[0] * center.
x + planeNormY[0] * center.
y + planeNormZ[0] * center.
z -
223 radiusVec - planeOffsetVec[0];
225 if (d0.
x >= 0 || d0.
y >= 0 || d0.
z >= 0)
228 Vec3<T> d1 = planeNormX[1] * center.
x + planeNormY[1] * center.
y + planeNormZ[1] * center.
z -
229 radiusVec - planeOffsetVec[1];
231 if (d1.
x >= 0 || d1.
y >= 0 || d1.
z >= 0)
237 template <
typename T>
242 Vec3<T> radiusVec =
Vec3<T> (sphere.radius, sphere.radius, sphere.radius);
245 Vec3<T> d0 = planeNormX[0] * center.
x + planeNormY[0] * center.
y + planeNormZ[0] * center.
z +
246 radiusVec - planeOffsetVec[0];
248 if (d0.
x >= 0 || d0.
y >= 0 || d0.
z >= 0)
251 Vec3<T> d1 = planeNormX[1] * center.
x + planeNormY[1] * center.
y + planeNormZ[1] * center.
z +
252 radiusVec - planeOffsetVec[1];
254 if (d1.
x >= 0 || d1.
y >= 0 || d1.
z >= 0)
260 template <
typename T>
271 Vec3<T> d0 = planeNormX[0] * center.
x + planeNormY[0] * center.
y + planeNormZ[0] * center.
z -
272 planeNormAbsX[0] * extent.
x - planeNormAbsY[0] * extent.
y -
273 planeNormAbsZ[0] * extent.
z - planeOffsetVec[0];
275 if (d0.
x >= 0 || d0.
y >= 0 || d0.
z >= 0)
278 Vec3<T> d1 = planeNormX[1] * center.
x + planeNormY[1] * center.
y + planeNormZ[1] * center.
z -
279 planeNormAbsX[1] * extent.
x - planeNormAbsY[1] * extent.
y -
280 planeNormAbsZ[1] * extent.
z - planeOffsetVec[1];
282 if (d1.
x >= 0 || d1.
y >= 0 || d1.
z >= 0)
288 template <
typename T>
299 Vec3<T> d0 = planeNormX[0] * center.
x + planeNormY[0] * center.
y + planeNormZ[0] * center.
z +
300 planeNormAbsX[0] * extent.
x + planeNormAbsY[0] * extent.
y +
301 planeNormAbsZ[0] * extent.
z - planeOffsetVec[0];
303 if (d0.
x >= 0 || d0.
y >= 0 || d0.
z >= 0)
306 Vec3<T> d1 = planeNormX[1] * center.
x + planeNormY[1] * center.
y + planeNormZ[1] * center.
z +
307 planeNormAbsX[1] * extent.
x + planeNormAbsY[1] * extent.
y +
308 planeNormAbsZ[1] * extent.
z - planeOffsetVec[1];
310 if (d1.
x >= 0 || d1.
y >= 0 || d1.
z >= 0)
316 template <
typename T>
321 Vec3<T> d0 = (planeNormX[0] * vec.x) + (planeNormY[0] * vec.y) + (planeNormZ[0] * vec.z) -
324 if (d0.
x >= 0 || d0.
y >= 0 || d0.
z >= 0)
327 Vec3<T> d1 = (planeNormX[1] * vec.x) + (planeNormY[1] * vec.y) + (planeNormZ[1] * vec.z) -
330 if (d1.
x >= 0 || d1.
y >= 0 || d1.
z >= 0)
342 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
344 #endif // INCLUDED_IMATHFRUSTUMTEST_H
#define IMATH_INTERNAL_NAMESPACE
GLdouble GLdouble GLdouble z
IMATH_INTERNAL_NAMESPACE::Frustum< T > currentFrustum() const IMATH_NOEXCEPT
Return the viewing frustum (primarily for debugging)
FrustumTest< float > FrustumTestf
FrustymTest of type float.
T distance
The distance from the origin to the plane.
FrustumTest() IMATH_NOEXCEPT
Initialize camera matrix to identity.
FrustumTest(const Frustum< T > &frustum, const Matrix44< T > &cameraMat) IMATH_NOEXCEPT
Initialize to a given frustum and camera matrix.
bool isVisible(const Sphere3< T > &sphere) const IMATH_NOEXCEPT
FrustumTest< double > FrustumTestd
FrustymTest of type double.
#define IMATH_EXPORT_TEMPLATE_TYPE
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE constexpr T abs(T a) IMATH_NOEXCEPT
bool completelyContains(const Sphere3< T > &sphere) const IMATH_NOEXCEPT
Vec3< T > normal
The normal to the plane.
IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT
Set to the identity matrix.
void setFrustum(const Frustum< T > &frustum, const Matrix44< T > &cameraMat) IMATH_NOEXCEPT