|
@@ -19,14 +19,14 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
private PointF pointOnLine;
|
|
|
private PointF start;
|
|
|
private PointF end;
|
|
|
- private bool startEndUpToDate;
|
|
|
+ private bool lineUpToDate;
|
|
|
|
|
|
public Finger(FingerPoint fingerPoint)
|
|
|
{
|
|
|
fingerPoints = new List<FingerPoint>();
|
|
|
nearest = fingerPoint;
|
|
|
farthest = fingerPoint;
|
|
|
- startEndUpToDate = false;
|
|
|
+ lineUpToDate = false;
|
|
|
addFingerPoint(fingerPoint);
|
|
|
}
|
|
|
|
|
@@ -42,16 +42,21 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
|
|
|
public PointF getStart()
|
|
|
{
|
|
|
- if (!startEndUpToDate) updateStartEnd();
|
|
|
+ if (!lineUpToDate) updateLine();
|
|
|
return start;
|
|
|
}
|
|
|
|
|
|
public PointF getEnd()
|
|
|
{
|
|
|
- if (!startEndUpToDate) updateStartEnd();
|
|
|
+ if (!lineUpToDate) updateLine();
|
|
|
return end;
|
|
|
}
|
|
|
|
|
|
+ public PointF getDirection() {
|
|
|
+ if (!lineUpToDate) updateLine();
|
|
|
+ return direction;
|
|
|
+ }
|
|
|
+
|
|
|
public void addFingerPoint(FingerPoint fingerPoint)
|
|
|
{
|
|
|
fingerPoints.Add(fingerPoint);
|
|
@@ -62,7 +67,7 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
//update farthest
|
|
|
if (fingerPoint.getDepth() > farthest.getDepth()) farthest = fingerPoint;
|
|
|
|
|
|
- startEndUpToDate = false;
|
|
|
+ lineUpToDate = false;
|
|
|
}
|
|
|
|
|
|
public float getMinDistance(FingerPoint fingerPoint)
|
|
@@ -101,7 +106,7 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
return new PointF(ox + q * dx, oy + q * dy);
|
|
|
}
|
|
|
|
|
|
- private void updateStartEnd() {
|
|
|
+ private void updateLine() {
|
|
|
//update direction+pointonline
|
|
|
PointF[] pointArray = new PointF[fingerPoints.Count];
|
|
|
int i = 0;
|
|
@@ -116,7 +121,7 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
start = projectToLine(new PointF(farthest.getX(), farthest.getY()));
|
|
|
end = projectToLine(new PointF(nearest.getX(), nearest.getY()));
|
|
|
|
|
|
- startEndUpToDate = true;
|
|
|
+ lineUpToDate = true;
|
|
|
}
|
|
|
}
|
|
|
}
|