|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.mit.sketch.toolkit.StrokeData
public class StrokeData
This class stores all the data from a single stroke. Time array has the same length as points.
| Field Summary | |
|---|---|
boolean |
a_is_valid
|
double[] |
acceleration
Time derivative of speed |
double[] |
accumulated_length
The accumulated length of the curve upto ith vertex. |
boolean |
accumulated_length_is_valid
|
Rectangle |
bounding_box
|
Point |
center
|
double[] |
d
Direction array. |
boolean |
d_is_valid
|
double[] |
dd_dt
Derivative of the direction array (d). |
Gaussian[] |
dd_dt_gaussians
|
boolean |
dd_dt_is_valid
|
double[][] |
dd_dt_scale_space
Direction change scale space information. |
boolean |
dd_dt_scale_space_is_valid
|
int |
direction_window_width
Parameters and constants. |
LinearFit.Method |
fit_method
|
PolarPoint[] |
polar_points
The vertices mapped to polar coordinates. |
boolean |
polar_points_is_valid
|
java.awt.Dimension |
radius
|
double[] |
speed
Time derivative of position |
Gaussian[] |
speed_gaussians
The gaussian filters. |
double[][] |
speed_scale_space
Speed scale space information. |
boolean |
speed_scale_space_is_valid
|
double |
test_line_scale
|
long[] |
time
The absolute time stamps for the vertices. |
boolean |
v_is_valid
|
Vertex[] |
vertices
The vertices in this data set. |
| Constructor Summary | |
|---|---|
StrokeData(double[] xs,
double[] ys,
double[] ts)
The constructor. |
|
StrokeData(Point[] points_in)
Create a stroke from these points, and by default, remove duplicate points |
|
StrokeData(Point[] points_in,
boolean removeDupes)
The constructor. |
|
StrokeData(Vertex[] vertices_in)
The constructor. |
|
| Method Summary | |
|---|---|
static double |
absAverage(double[] l)
|
static double |
average(double[] l)
|
double |
averageAbsoluteFinG(double[] f,
double[] g)
Average |
double |
averageAbsoluteFinG(double[] f,
long[] g)
Average |
double |
averageFinG(double[] f,
double[] g)
Average |
double |
averageFinG(double[] f,
long[] g)
Average |
double |
averageSpeed()
Average speed |
void |
convolveChangeInDirection(double[] filter)
Do convolution. |
void |
convolveDirection(double[] filter)
Do convolution. |
double |
cosAngle(Point p,
Point pl,
Point pr)
|
void |
derive_accumulated_length()
Compute the derive accumulated length. |
void |
derive_d(LinearFit.Method method)
Derive direction, and fill in the d array. |
void |
derive_dd_dt_scale_space()
Compute the scale space data. |
void |
derive_dd_dt()
Find time derivative of direction, and fill in the dd_dt array. |
void |
derive_speed_scale_space()
Compute the scale space data. |
void |
deriveAcceleration()
Derive acceleration, and fill in the acceleration array. |
void |
deriveBoundingBox()
Derive the bounding box for the vertices. |
double[] |
deriveDirectionUsingRotationalSWODR(Point[] input,
int window_span)
Derive direction, and return it. |
double[] |
deriveDirectionViaSWODR(Point[] input,
int twice_window_size)
Derive direction, and fill in the d array. |
void |
derivePolarCoordinates()
Derive the polar coordinates of the vertices with respect to the center. |
void |
derivePolarCoordinates(double x,
double y,
int width,
int height)
|
void |
deriveProperties()
Derive speed, and fill in the speed array. |
void |
deriveScaleSpaces()
Derive speed, and fill in the speed array. |
void |
deriveSpeed()
Derive speed, and fill in the speed array. |
double |
diagnolLength()
|
double[] |
differantiateDirection(double[] direction)
Differantiate the direction array using the current timing data. |
int[] |
filterCollinearVertices(int[] indices)
filterCollinearVertices. |
int[] |
filterVerticesByLSQE(int[] indices,
double percentTolerance)
filterCollinearVertices. |
Vertex[] |
filterVerticesByLSQE(Vertex[] vertices,
double percentTolerance)
filterCollinearVertices. |
int[] |
filterVerticesDownToN(int[] inds,
int num)
|
Vertex[] |
filterVerticesDownToN(Vertex[] verts,
int num)
|
Vertex[] |
filterVerticesDownToN(Vertex[] verts,
int num,
double errorBound)
|
double[] |
getAngles()
Get the directions for each of the vertex points. |
Rectangle |
getBoundingBox()
Get the bounding box for this stroke. |
Polygon |
getDataPoints()
Put the valid points in the points array in a Polygon and return it. |
Vertex[] |
getDirectionFit(double dd_dt_scale)
Find the corners of the polygon using the change in the direction. |
Ellipse |
getEllipse()
Return the ellipse fully containing the data points. |
Ellipse |
getEllipseBB()
|
long |
getEndTime()
|
int |
getNumVertices()
|
java.awt.geom.Rectangle2D |
getOriginalBounds()
Get the bounding box of the original points instead of the filtered points. |
Point[] |
getOrigPoints()
|
Vertex[] |
getPolygonFit(double threshold,
int min_size)
Finds a polygon approximation using the a greedy error threshold method |
java.lang.Object |
getProperty(java.lang.String name)
Get a property's value. |
java.lang.Object |
getProperty(java.lang.String name,
java.lang.Object defaultVal)
Get a property's value. |
Vertex[] |
getSpeedFit(double average_scale)
Return the speed fit |
long |
getStartTime()
|
double |
getStrokeLength()
|
StrokeData |
getTranslated(double dx,
double dy)
Get a copy of this stroke data object translated by (x,y) |
Vertex[] |
getVertices()
Return the vertices array. |
StrokeData |
interpolatePoints(double maxDist)
This interpolates points along the stroke such that there is never more than maxDist between adjacent points. |
void |
invalidateCaches()
Invalidates caches |
double |
leastSquaresForCircle()
|
double |
leastSquaresForCircle2()
calculate the lsq error. |
double |
leastSquaresForEllipse()
calculate the lsq error. |
static void |
main(java.lang.String[] args)
|
static double[] |
normalize(double[] l)
|
void |
paint(java.awt.Graphics g)
Paint |
void |
paint(java.awt.Graphics g,
Range range,
java.awt.Color c)
Paint points in range with color c |
Point[] |
removeDuplicatePoints(Point[] points_in)
Remove points w/repeating (x,y) or t |
Vertex[] |
removeDuplicateVertices(Vertex[] vertices_in)
Remove vertices w/repeating (x,y) or t |
Point[] |
removeHooks(Point[] points_in)
Removes hook artifacts, signified by regions of high curvature within 10 pixels of the beginning or end of a stroke |
java.lang.Object |
removeProperty(java.lang.String name)
Remove the mapping for the given property. |
Vertex[] |
removeRedundantEndPoints(Vertex[] input_points)
Remove the redundant at the beginning and the end. |
void |
setFitMethod(LinearFit.Method method)
Set fit method |
void |
setOrigPoints(Point[] points)
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set a property to the given value. |
Vertex[] |
smFit(double tolerance)
Return the split and merge fit. |
boolean |
testLine(double test_line_scale)
See if the input is a line. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public Vertex[] vertices
public long[] time
public transient double[] speed
public transient double[] acceleration
public transient double[] d
public transient double[] dd_dt
public transient double[] accumulated_length
public transient double[][] speed_scale_space
public transient double[][] dd_dt_scale_space
public transient Gaussian[] speed_gaussians
public transient Gaussian[] dd_dt_gaussians
public PolarPoint[] polar_points
public int direction_window_width
public LinearFit.Method fit_method
public double test_line_scale
public Point center
public Rectangle bounding_box
public java.awt.Dimension radius
public boolean v_is_valid
public boolean a_is_valid
public boolean d_is_valid
public boolean dd_dt_is_valid
public boolean polar_points_is_valid
public boolean accumulated_length_is_valid
public boolean dd_dt_scale_space_is_valid
public boolean speed_scale_space_is_valid
| Constructor Detail |
|---|
public StrokeData(double[] xs,
double[] ys,
double[] ts)
public StrokeData(Vertex[] vertices_in)
public StrokeData(Point[] points_in,
boolean removeDupes)
public StrokeData(Point[] points_in)
points_in - The points making up the stroke| Method Detail |
|---|
public Point[] getOrigPoints()
public void setOrigPoints(Point[] points)
public Point[] removeDuplicatePoints(Point[] points_in)
public Vertex[] removeDuplicateVertices(Vertex[] vertices_in)
public Point[] removeHooks(Point[] points_in)
public double cosAngle(Point p,
Point pl,
Point pr)
public StrokeData interpolatePoints(double maxDist)
maxDist - Max distance allowed between consequtive points
public void deriveProperties()
public void deriveScaleSpaces()
public void invalidateCaches()
public Vertex[] getVertices()
public double[] getAngles()
public Rectangle getBoundingBox()
public void derivePolarCoordinates()
public void derivePolarCoordinates(double x,
double y,
int width,
int height)
public void deriveBoundingBox()
public java.awt.geom.Rectangle2D getOriginalBounds()
public long getStartTime()
public long getEndTime()
public void deriveSpeed()
public void deriveAcceleration()
public void derive_d(LinearFit.Method method)
public void derive_dd_dt()
public void derive_accumulated_length()
public void derive_dd_dt_scale_space()
public void derive_speed_scale_space()
public Vertex[] filterVerticesDownToN(Vertex[] verts,
int num)
public Vertex[] filterVerticesDownToN(Vertex[] verts,
int num,
double errorBound)
public int[] filterVerticesDownToN(int[] inds,
int num)
public Vertex[] filterVerticesByLSQE(Vertex[] vertices,
double percentTolerance)
public int[] filterVerticesByLSQE(int[] indices,
double percentTolerance)
public int[] filterCollinearVertices(int[] indices)
public double[] deriveDirectionUsingRotationalSWODR(Point[] input,
int window_span)
public double[] deriveDirectionViaSWODR(Point[] input,
int twice_window_size)
public double[] differantiateDirection(double[] direction)
public double averageSpeed()
public double averageFinG(double[] f,
double[] g)
public double averageAbsoluteFinG(double[] f,
double[] g)
public double averageFinG(double[] f,
long[] g)
public double averageAbsoluteFinG(double[] f,
long[] g)
public Polygon getDataPoints()
public Vertex[] smFit(double tolerance)
public Vertex[] getSpeedFit(double average_scale)
public Vertex[] getDirectionFit(double dd_dt_scale)
public static double[] normalize(double[] l)
public static double average(double[] l)
public static double absAverage(double[] l)
public Vertex[] getPolygonFit(double threshold,
int min_size)
public double diagnolLength()
public boolean testLine(double test_line_scale)
public Ellipse getEllipse()
public Ellipse getEllipseBB()
public double leastSquaresForEllipse()
public double leastSquaresForCircle()
public double leastSquaresForCircle2()
public Vertex[] removeRedundantEndPoints(Vertex[] input_points)
public void setFitMethod(LinearFit.Method method)
public void convolveDirection(double[] filter)
public void convolveChangeInDirection(double[] filter)
public void paint(java.awt.Graphics g)
public int getNumVertices()
public StrokeData getTranslated(double dx,
double dy)
dx - Translate this far in xdy - Translate this far in y
public void paint(java.awt.Graphics g,
Range range,
java.awt.Color c)
public double getStrokeLength()
public void setProperty(java.lang.String name,
java.lang.Object value)
public java.lang.Object getProperty(java.lang.String name)
public java.lang.Object getProperty(java.lang.String name,
java.lang.Object defaultVal)
public java.lang.Object removeProperty(java.lang.String name)
public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||