edu.stanford.hci.r3.pen.ink
Class InkUtils

java.lang.Object
  extended by edu.stanford.hci.r3.pen.ink.InkUtils

public class InkUtils
extends java.lang.Object

Integrate all the nice features that we can use to analyze ink into this class.

This software is distributed under the BSD License.


Constructor Summary
InkUtils()
           
 
Method Summary
static java.util.List<Ink> clusterStrokes(java.util.List<InkStroke> strokes, double margin)
          Clusters a list of strokes into a list of list of strokes.
static java.util.List<InkStroke> getAllStrokesContainedWithin(java.util.List<Ink> inkWell, InkStroke container)
          Finds all the strokes contained within another stroke's bounding box.
static java.util.List<InkStroke> getAllStrokesOutside(java.util.List<Ink> inkWell, InkStroke container)
          Finds all strokes outside a containing stroke (no overlap)
static java.util.List<java.lang.reflect.Method> getExposedMethods()
          Last year's Remote API fun was actually useful! Wow.
static Ink getInkNearPoint(java.util.List<Ink> inkWell, java.awt.geom.Point2D point, double range)
          Finds the first clusters near a particular point (perhaps revise to find nearest cluster).
static double getMaxDistanceBetweenSamples(InkStroke stroke)
           
static java.util.List<InkStroke> getStrokesPartlyOutside(java.util.List<Ink> inkWell, InkStroke container)
          Finds all strokes that intersect with but are not entirely contained by another stroke.
static InkStroke getStrokeWithLargestArea(java.util.List<Ink> inkWell)
          Finds the stroke with the largest area within a list of clusters.
static Ink getStrokeWithMostSamples(Ink ink)
          Use this in the example!
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InkUtils

public InkUtils()
Method Detail

clusterStrokes

public static java.util.List<Ink> clusterStrokes(java.util.List<InkStroke> strokes,
                                                 double margin)
Clusters a list of strokes into a list of list of strokes. The margin allows you to control how big the compared bounding boxes are. A margin of 2.0 would double the width and height of each bounding box before making intersection comparisons.

Parameters:
strokes - list of strokes to group
margin - the fraction of each stroke size to check for overlap
Returns:
a list of inkstroke clusters

getAllStrokesContainedWithin

public static java.util.List<InkStroke> getAllStrokesContainedWithin(java.util.List<Ink> inkWell,
                                                                     InkStroke container)
Finds all the strokes contained within another stroke's bounding box.

Parameters:
inkWell - the strokes to check
container - the containing stroke
Returns:
a list of strokes within the container

getAllStrokesOutside

public static java.util.List<InkStroke> getAllStrokesOutside(java.util.List<Ink> inkWell,
                                                             InkStroke container)
Finds all strokes outside a containing stroke (no overlap)

Parameters:
inkWell - the list of strokes to check
container - the containing stroke
Returns:
a list of strokes not within the container

getExposedMethods

public static java.util.List<java.lang.reflect.Method> getExposedMethods()
Last year's Remote API fun was actually useful! Wow.

Returns:

getInkNearPoint

public static Ink getInkNearPoint(java.util.List<Ink> inkWell,
                                  java.awt.geom.Point2D point,
                                  double range)
Finds the first clusters near a particular point (perhaps revise to find nearest cluster).

Parameters:
inkWell - list of clusters
point - the point to compare to
range - number of units away from the point to check
Returns:
the first cluster near the point

getMaxDistanceBetweenSamples

public static double getMaxDistanceBetweenSamples(InkStroke stroke)
Parameters:
stroke -
Returns:

getStrokesPartlyOutside

public static java.util.List<InkStroke> getStrokesPartlyOutside(java.util.List<Ink> inkWell,
                                                                InkStroke container)
Finds all strokes that intersect with but are not entirely contained by another stroke.

Parameters:
inkWell - the list of strokes
container - the containing stroke
Returns:
a list of strokes that are partly inside and outside the container

getStrokeWithLargestArea

public static InkStroke getStrokeWithLargestArea(java.util.List<Ink> inkWell)
Finds the stroke with the largest area within a list of clusters.

Parameters:
inkWell - the list of clusters
Returns:
the inkstroke with the largest area

getStrokeWithMostSamples

public static Ink getStrokeWithMostSamples(Ink ink)
Use this in the example!

Parameters:
ink -
Returns:

main

public static void main(java.lang.String[] args)
Parameters:
args -

Copyright 2006 Stanford University