edu.mit.sketch.toolkit
Class AWTUtil

java.lang.Object
  |
  +--edu.mit.sketch.toolkit.AWTUtil

public class AWTUtil
extends Object

Implements some methods not found in jdk 1.1


Field Summary
static Color[] colors
           
static Color[] colors2
           
 
Constructor Summary
AWTUtil()
           
 
Method Summary
static Vertex[] flatten(Shape shape, double flatness, int limit)
          Return an array of vertices corresponding to the flattened version of the input.
static Component[] getAllComponentsRecursively(Container container)
          Get all the sub componets in this container.
static double getCurveLSQEror(Shape shape, StrokeData data, Range range)
          Get the LSQE for the curve by measuring the distance to the vertices in range.
static double leastSquaresForLine(Line line, Point[] points)
          calculate the lsq error.
static double leastSquaresForPolygon(Vertex[] vertices, Point[] points)
          calculate the lsq error.
static void paintDot(double x, double y, Color color, Component component, AffineTransform transform)
          Paint x vs y in the frame using the input color and affine transform.
static void paintDot(double x, double y, Color color, Image image, AffineTransform transform)
          Paint x vs y in the frame using the input color and affine transform.
static void paintDot(int x, int y, Color color, Component component, AffineTransform transform)
          Paint x vs y in the frame using the input color and affine transform.
static void paintDot(int x, int y, Color color, Image image, AffineTransform transform)
          Paint x vs y in the frame using the input color and affine transform.
static void paintDots(double[] f, double[] g, Color color, Component component, AffineTransform transform, int brush_size)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(double[] f, double[] g, Color color, Image image, AffineTransform transform, int brush_size)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(double[] f, int[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(double[] f, int[] g, Color color, Image image, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, double[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, double[] g, Color color, Component component, AffineTransform transform, int brush_size)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, double[] g, Color color, Image image, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, double[] g, Color color, Image image, AffineTransform transform, int brush_size)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, int[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintDots(int[] f, int[] g, Color color, Image image, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintFvsG(double[] f, double[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintFvsG(double[] f, double[] g, Color color, Image image, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintFvsG(long[] f, double[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintFvsG(long[] f, double[] g, Color color, Image image, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
static void paintLine(Line line, Color color, Component component, AffineTransform transform)
          Paint line.
static void paintLine(Line line, Color color, Image image, AffineTransform transform)
          Paint line.
static Vertex[] simplifyPolygon(Vertex[] input_vertices, double turn_angle_treshold)
          Simplify the polygon to get rid of consecutive lines which are sufficiently parallel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colors

public static final Color[] colors

colors2

public static final Color[] colors2
Constructor Detail

AWTUtil

public AWTUtil()
Method Detail

getAllComponentsRecursively

public static Component[] getAllComponentsRecursively(Container container)
Get all the sub componets in this container.

flatten

public static Vertex[] flatten(Shape shape,
                               double flatness,
                               int limit)
Return an array of vertices corresponding to the flattened version of the input.

getCurveLSQEror

public static double getCurveLSQEror(Shape shape,
                                     StrokeData data,
                                     Range range)
Get the LSQE for the curve by measuring the distance to the vertices in range. It is only valid to pass curves in, but you are more than welcome to try calling it with other shapes.

leastSquaresForPolygon

public static double leastSquaresForPolygon(Vertex[] vertices,
                                            Point[] points)
calculate the lsq error. points is the actual data points, polgon is the match

leastSquaresForLine

public static double leastSquaresForLine(Line line,
                                         Point[] points)
calculate the lsq error. points is the actual data points

paintFvsG

public static void paintFvsG(double[] f,
                             double[] g,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

paintFvsG

public static void paintFvsG(double[] f,
                             double[] g,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

paintLine

public static void paintLine(Line line,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint line.

paintLine

public static void paintLine(Line line,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint line.

paintDots

public static void paintDots(double[] f,
                             int[] g,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(double[] f,
                             int[] g,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(double[] f,
                             double[] g,
                             Color color,
                             Image image,
                             AffineTransform transform,
                             int brush_size)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(double[] f,
                             double[] g,
                             Color color,
                             Component component,
                             AffineTransform transform,
                             int brush_size)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             double[] g,
                             Color color,
                             Image image,
                             AffineTransform transform,
                             int brush_size)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             double[] g,
                             Color color,
                             Component component,
                             AffineTransform transform,
                             int brush_size)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             double[] g,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             double[] g,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             int[] g,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDots

public static void paintDots(int[] f,
                             int[] g,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis. Use dots.

paintDot

public static void paintDot(int x,
                            int y,
                            Color color,
                            Image image,
                            AffineTransform transform)
Paint x vs y in the frame using the input color and affine transform. x is on the horizontal axis. Use dots.

paintDot

public static void paintDot(int x,
                            int y,
                            Color color,
                            Component component,
                            AffineTransform transform)
Paint x vs y in the frame using the input color and affine transform. x is on the horizontal axis. Use dots.

paintDot

public static void paintDot(double x,
                            double y,
                            Color color,
                            Image image,
                            AffineTransform transform)
Paint x vs y in the frame using the input color and affine transform. x is on the horizontal axis. Use dots.

paintDot

public static void paintDot(double x,
                            double y,
                            Color color,
                            Component component,
                            AffineTransform transform)
Paint x vs y in the frame using the input color and affine transform. x is on the horizontal axis. Use dots.

paintFvsG

public static void paintFvsG(long[] f,
                             double[] g,
                             Color color,
                             Image image,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

paintFvsG

public static void paintFvsG(long[] f,
                             double[] g,
                             Color color,
                             Component component,
                             AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

simplifyPolygon

public static Vertex[] simplifyPolygon(Vertex[] input_vertices,
                                       double turn_angle_treshold)
Simplify the polygon to get rid of consecutive lines which are sufficiently parallel.