iicm.utils3d
Class PickUtil

java.lang.Object
  |
  +--iicm.utils3d.PickUtil

public abstract class PickUtil
extends java.lang.Object


Method Summary
static boolean rayhitsconeside(Ray ray, float height, float radius, boolean twosided, Hitpoint hitpoint)
          pick a cone's side. test whether ray hits the side wall of a cone (given by height and radius). to pick a complete cone also check bottom disk at y = - height/2.
static boolean rayhitscube(Ray ray, float[] min, float[] max, Hitpoint hitpoint, boolean inside)
          pick a cube. test whether ray hits an axis-aligned cube given by (min, max) at a hittime (strict) within near/far ranges of ray.
static boolean rayhitscube(Ray ray, Vec3f min, Vec3f max, Hitpoint hitpoint)
          pick a cube from outside.
static boolean rayhitscylinderside(Ray ray, float height, float radius, boolean twosided, Hitpoint hitpoint, boolean noheight)
          pick a cylinder's side. test whether ray hits a cylinder (given by height and radius). to pick a complete cylinder also check top and bottom disks at y = +/- height/2.
static boolean rayhitsdisk(Ray ray, float y, float r, boolean top, boolean bottom, Hitpoint hitpoint, boolean sens)
          pick a disk. test whether ray hits a disk parallel to the xz plane at height y with radius r from top or bottom (according to these flags). if flag sens is true the radius is infinitely large
static boolean rayhitsplane(Ray ray, Hitpoint hitpoint)
          pick a plane. test whether ray hits the xy plane (z = 0) from either side at a hittime > 0.
static boolean rayhitssphere(Ray ray, float radius, boolean twosided, Hitpoint hitpoint)
          pick a sphere. test whether ray hits a sphere, centered at origin with given radius; twosided if flag set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rayhitscube

public static boolean rayhitscube(Ray ray,
                                  Vec3f min,
                                  Vec3f max,
                                  Hitpoint hitpoint)
pick a cube from outside. See below.

rayhitscube

public static boolean rayhitscube(Ray ray,
                                  float[] min,
                                  float[] max,
                                  Hitpoint hitpoint,
                                  boolean inside)
pick a cube. test whether ray hits an axis-aligned cube given by (min, max) at a hittime (strict) within near/far ranges of ray. In this case, hitpoint.hittime_ (and normal_ if non-null) is/are updated. The ray itself is not changed.
Parameters:
inside - flag whether to pick the inner (on true) or outer side of the cube
Returns:
flag whether a hit occured (hitpoint updated in this case)

rayhitssphere

public static boolean rayhitssphere(Ray ray,
                                    float radius,
                                    boolean twosided,
                                    Hitpoint hitpoint)
pick a sphere. test whether ray hits a sphere, centered at origin with given radius; twosided if flag set.
Returns:
flag whether a hit occured (hitpoint updated in this case)

rayhitsdisk

public static boolean rayhitsdisk(Ray ray,
                                  float y,
                                  float r,
                                  boolean top,
                                  boolean bottom,
                                  Hitpoint hitpoint,
                                  boolean sens)
pick a disk. test whether ray hits a disk parallel to the xz plane at height y with radius r from top or bottom (according to these flags). if flag sens is true the radius is infinitely large
Returns:
flag whether a hit occured (hitpoint updated in this case)
See Also:
rayhitscube(iicm.utils3d.Ray, iicm.utils3d.Vec3f, iicm.utils3d.Vec3f, iicm.utils3d.Hitpoint)

rayhitsconeside

public static boolean rayhitsconeside(Ray ray,
                                      float height,
                                      float radius,
                                      boolean twosided,
                                      Hitpoint hitpoint)
pick a cone's side. test whether ray hits the side wall of a cone (given by height and radius). to pick a complete cone also check bottom disk at y = - height/2.
Returns:
flag whether a hit occured (hitpoint updated in this case)
See Also:
rayhitsdisk(iicm.utils3d.Ray, float, float, boolean, boolean, iicm.utils3d.Hitpoint, boolean)

rayhitscylinderside

public static boolean rayhitscylinderside(Ray ray,
                                          float height,
                                          float radius,
                                          boolean twosided,
                                          Hitpoint hitpoint,
                                          boolean noheight)
pick a cylinder's side. test whether ray hits a cylinder (given by height and radius). to pick a complete cylinder also check top and bottom disks at y = +/- height/2.
Returns:
flag whether a hit occured (hitpoint updated in this case)
See Also:
rayhitsdisk(iicm.utils3d.Ray, float, float, boolean, boolean, iicm.utils3d.Hitpoint, boolean)

rayhitsplane

public static boolean rayhitsplane(Ray ray,
                                   Hitpoint hitpoint)
pick a plane. test whether ray hits the xy plane (z = 0) from either side at a hittime > 0. In this case, hitpoint.hittime_ (and normal_ if non-null) is/are updated. The ray itself is not changed.
Returns:
flag whether a hit occured (hitpoint updated in this case)