edu.umd.cs.jazz.util
Class ZUtil

java.lang.Object
  |
  +--edu.umd.cs.jazz.util.ZUtil

public class ZUtil
extends java.lang.Object

Provide some generic, useful routines


Constructor Summary
ZUtil()
           
 
Method Summary
static float angleBetweenPoints(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
          Returns the angle in radians between point a and point b from point pt, that is the angle between a-pt-b.
static double lerp(double t, double a, double b)
          Linearly interpolates between a and b, based on t.
static float lerp(float t, float a, float b)
          Linearly interpolates between a and b, based on t.
static boolean rectIntersectsPolyline(java.awt.geom.Rectangle2D rect, float[] xp, float[] yp, float penWidth)
          Determine if the specified rectangle intersects the specified polyline.
static void transform(java.awt.geom.Rectangle2D rect, java.awt.geom.AffineTransform tf)
          Apply the specified transform to the specified rectangle, modifying the rect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZUtil

public ZUtil()
Method Detail

lerp

public static float lerp(float t,
                         float a,
                         float b)
Linearly interpolates between a and b, based on t. Specifically, it computes lerp(a, b, t) = a + t*(b - a). This produces a result that changes from a (when t = 0) to b (when t = 1).
Parameters:
a - from point
b - to Point
t - variable 'time' parameter

lerp

public static double lerp(double t,
                          double a,
                          double b)
Linearly interpolates between a and b, based on t. Specifically, it computes lerp(a, b, t) = a + t*(b - a). This produces a result that changes from a (when t = 0) to b (when t = 1).
Parameters:
a - from point
b - to Point
t - variable 'time' parameter

transform

public static void transform(java.awt.geom.Rectangle2D rect,
                             java.awt.geom.AffineTransform tf)
Apply the specified transform to the specified rectangle, modifying the rect.

rectIntersectsPolyline

public static boolean rectIntersectsPolyline(java.awt.geom.Rectangle2D rect,
                                             float[] xp,
                                             float[] yp,
                                             float penWidth)
Determine if the specified rectangle intersects the specified polyline.
Parameters:
rect - The rectangle that is being tested for intersection
xp - The array of X-coordinates that determines the polyline
yp - The array of Y-coordinates that determines the polyline
penWidth - The width of the polyline
Returns:
true if the rectangle intersects the polyline.

angleBetweenPoints

public static float angleBetweenPoints(java.awt.geom.Point2D pt,
                                       java.awt.geom.Point2D a,
                                       java.awt.geom.Point2D b)
Returns the angle in radians between point a and point b from point pt, that is the angle between a-pt-b.
Parameters:
pt,a,b - The points that specify the angle
Returns:
the angle