Advertisement
Guest User

Untitled

a guest
Jun 6th, 2012
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. /**
  2.   * Returns wheter the given sphere is in the frustum.
  3.   *
  4.   * @param center
  5.   *                 The center of the sphere
  6.   * @param radius
  7.   *                 The radius of the sphere
  8.   * @return Wheter the sphere is in the frustum
  9.   */
  10. public boolean sphereInFrustum(Vector3 center, float radius) {
  11.   for (int i = 0; i < 6; i++)
  12.    if ((planes[i].normal.x * center.x + planes[i].normal.y * center.y + planes[i].normal.z
  13.          * center.z) < (-radius - planes[i].d))
  14.     return false;
  15.   return true;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement