hhreco.toolbox
Class InterpolateStrokeFilter

java.lang.Object
  extended byhhreco.toolbox.StrokeFilter
      extended byhhreco.toolbox.InterpolateStrokeFilter

public class InterpolateStrokeFilter
extends StrokeFilter

For every 2 consecutive points in a stroke, fill in with evenly spaced points until the distance in between any 2 consecutive points no longer exceeds the threshold distance.


Field Summary
static double DEFAULT_SPACING
          The maximum spacing allowed between two consecutive points.
 
Constructor Summary
InterpolateStrokeFilter()
          Create a InterpolateStrokeFilter with the default spacing.
InterpolateStrokeFilter(double spacing)
          Create a InterpolateStrokeFilter with the specified spacing.
 
Method Summary
 TimedStroke apply(TimedStroke s)
          Interpolate the given stroke such that no 2 consecutive points in the stroke has a distance greater than the pre-defined spacing.
 double getSpacing()
          Return the spacing parameter.
static TimedStroke interpolate(TimedStroke s)
          Interpolate the points in the given stroke using the default spacing value.
static TimedStroke interpolate(TimedStroke s, double spacing)
          Interpolate the points in the given stroke using the specified spacing value.
 void setSpacing(double val)
          Set the spacing value for adding interpolated points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SPACING

public static final double DEFAULT_SPACING
The maximum spacing allowed between two consecutive points.

See Also:
Constant Field Values
Constructor Detail

InterpolateStrokeFilter

public InterpolateStrokeFilter()
Create a InterpolateStrokeFilter with the default spacing.


InterpolateStrokeFilter

public InterpolateStrokeFilter(double spacing)
Create a InterpolateStrokeFilter with the specified spacing.

Method Detail

apply

public TimedStroke apply(TimedStroke s)
Interpolate the given stroke such that no 2 consecutive points in the stroke has a distance greater than the pre-defined spacing.

Specified by:
apply in class StrokeFilter

interpolate

public static TimedStroke interpolate(TimedStroke s)
Interpolate the points in the given stroke using the default spacing value.


interpolate

public static TimedStroke interpolate(TimedStroke s,
                                      double spacing)
Interpolate the points in the given stroke using the specified spacing value.


getSpacing

public double getSpacing()
Return the spacing parameter.


setSpacing

public void setSpacing(double val)
Set the spacing value for adding interpolated points. Throw an IllegalArgumentException if the input value is <= 0.