public class Approximator
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Approximator.ApproximatorType
enums for the different types of filtering algorithms
|
| Constructor and Description |
|---|
Approximator()
Initializes the approximator with type NONE
|
Approximator(Approximator.ApproximatorType type,
double tolerance)
Initializes the approximator with the given type and tolerance.
|
| Modifier and Type | Method and Description |
|---|---|
double |
calcAngle(Entry p1,
Entry p2)
calculates the angle between two Entries (points) in the chart
|
double |
calcAngleBetweenLines(Entry start1,
Entry end1,
Entry start2,
Entry end2)
Calculates the angle between two given lines.
|
double |
calcAngleWithRatios(Entry p1,
Entry p2)
calculates the angle between two Entries (points) in the chart taking
ratios into consideration
|
double |
calcPointToLineDistance(Entry startEntry,
Entry endEntry,
Entry entryPoint)
calculate the distance between a line between two entries and an entry
(point)
|
java.util.List<Entry> |
filter(java.util.List<Entry> points)
Filters according to type.
|
java.util.List<Entry> |
filter(java.util.List<Entry> points,
double tolerance)
Filters according to type.
|
void |
setRatios(float deltaRatio,
float scaleRatio)
Sets the ratios for x- and y-axis, as well as the ratio of the scale
levels
|
void |
setTolerance(double tolerance)
sets the tolerance for the Approximator.
|
void |
setType(Approximator.ApproximatorType type)
Sets the filtering algorithm that should be used.
|
void |
setup(Approximator.ApproximatorType type,
double tolerance)
sets type and tolerance, if tolerance <= 0, no filtering will be done
|
public Approximator()
public Approximator(Approximator.ApproximatorType type, double tolerance)
type - public void setup(Approximator.ApproximatorType type, double tolerance)
type - tolerance - public void setTolerance(double tolerance)
public void setType(Approximator.ApproximatorType type)
type - public void setRatios(float deltaRatio,
float scaleRatio)
deltaRatio - scaleRatio - public java.util.List<Entry> filter(java.util.List<Entry> points)
points - the points to filterpublic java.util.List<Entry> filter(java.util.List<Entry> points, double tolerance)
points - the points to filtertolerance - the angle in degrees that will trigger the filteringpublic double calcPointToLineDistance(Entry startEntry, Entry endEntry, Entry entryPoint)
startEntry - line startpointendEntry - line endpointentryPoint - the point to which the distance is measured from the
linepublic double calcAngleBetweenLines(Entry start1, Entry end1, Entry start2, Entry end2)
start1 - end1 - start2 - end2 - public double calcAngleWithRatios(Entry p1, Entry p2)
p1 - p2 -