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 |
ZUtil
public ZUtil()
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 pointb - to Pointt - 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 pointb - to Pointt - 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 intersectionxp - The array of X-coordinates that determines the polylineyp - The array of Y-coordinates that determines the polylinepenWidth - 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