scenic
Class Util

java.lang.Object
  extended by scenic.Util

public class Util
extends java.lang.Object

This class contains utility methods.


Constructor Summary
Util()
           
 
Method Summary
static void combine(java.awt.Rectangle a, int x, int y)
          Combines the given rectangle with the given point.
static void combine(java.awt.Rectangle a, java.awt.Rectangle b)
          Combines the two rectangles.
static void common(java.awt.Rectangle a, java.awt.Rectangle b)
          Calculates the common area shared by the rectangles.
static boolean hasCommonArea(java.awt.Rectangle a, java.awt.Rectangle b)
           
static java.awt.geom.AffineTransform linearTransform(java.awt.geom.AffineTransform a)
           
static java.awt.geom.AffineTransform multiply(java.awt.geom.AffineTransform a, java.awt.geom.AffineTransform b)
           
static int toPowerOfTwo(int size)
          Returns a power of two that is larger or equal to the given value.
static java.awt.Rectangle transform(java.awt.geom.AffineTransform a, java.awt.Rectangle b)
          Returns a rectangle that contains the area of the given rectangle transformed by the given transform.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

combine

public static void combine(java.awt.Rectangle a,
                           int x,
                           int y)
Combines the given rectangle with the given point. The given rectangle is modified so that it includes the given point.

Parameters:
a - the rectangle.
x - the x coordinate of the point
y - the y coodrinate of the point

combine

public static void combine(java.awt.Rectangle a,
                           java.awt.Rectangle b)
Combines the two rectangles. The rectangle a is modified so that it contains the are defined by rectangle b.

Parameters:
a - the first rectangle.
b - the second rectangle.

common

public static void common(java.awt.Rectangle a,
                          java.awt.Rectangle b)
Calculates the common area shared by the rectangles. The rectangle a is modified so that it contains the common area of the two rectangles. The common area is the largest rectangle that is inside the two rectangles.

Parameters:
a - the first rectangle.
b - the second rectangle.

hasCommonArea

public static boolean hasCommonArea(java.awt.Rectangle a,
                                    java.awt.Rectangle b)

toPowerOfTwo

public static int toPowerOfTwo(int size)
Returns a power of two that is larger or equal to the given value. Power of two is a value of the form 2^n, where n is any integer >= 0. So, for example, for the value 30 this method would return 32.

Parameters:
size - the value.
Returns:
the power of two.

transform

public static java.awt.Rectangle transform(java.awt.geom.AffineTransform a,
                                           java.awt.Rectangle b)
Returns a rectangle that contains the area of the given rectangle transformed by the given transform.

Parameters:
a - the transform.
b - the rectangle.
Returns:
the combination.

multiply

public static java.awt.geom.AffineTransform multiply(java.awt.geom.AffineTransform a,
                                                     java.awt.geom.AffineTransform b)

linearTransform

public static java.awt.geom.AffineTransform linearTransform(java.awt.geom.AffineTransform a)