Package cnuphys.swim
Class SwimTrajectory2D
java.lang.Object
cnuphys.swim.SwimTrajectory2D
A 2D version of the 3D SwimTrajectory where all points have been projected
onto a 2D plane.
- Author:
- heddle
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSwimTrajectory2D
(SwimTrajectory trajectory, IProjector projector) Create a 2D trajectory from the 3D trajectory -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToFeedback
(List<String> feedbackStrings) Add to the feedback stringsdouble
Get the minimum distance to the trajectory.int
Get the index of the first sector change.getPath()
Get the 2D path.Get the source of the trajectory, e.g., hbtrackingstatic double
perpendicularDistance
(Point2D.Double p0, Point2D.Double p1, Point2D.Double wp, Point2D.Double pintersect) Given two points p0 and p1, imagine a line from p0 to p1.int[]
Get the indices of sector changesint
Get the count of sector changessectorChangeString
(int index) Get a string describing the sector changeGet a summary string for the trajectory
-
Field Details
-
fbColor
- See Also:
-
SMALL_THETA
- See Also:
-
SMALL_PHI
- See Also:
-
SUPER2
- See Also:
-
-
Constructor Details
-
SwimTrajectory2D
Create a 2D trajectory from the 3D trajectory- Parameters:
trajectory
- the 3D trajectory from a swimprojector
- projects 3D to 2D
-
-
Method Details
-
sectChangeIndices
public int[] sectChangeIndices()Get the indices of sector changes- Returns:
- the indices of sector changes (or null)
-
sectorChangeCount
public int sectorChangeCount()Get the count of sector changes- Returns:
- the count of sector changes
-
firstSectorChangeIndex
public int firstSectorChangeIndex()Get the index of the first sector change. If no change, return -1.- Returns:
- the index of the first sector
-
sectorChangeString
Get a string describing the sector change- Parameters:
index
- this should be the first index of the new sector- Returns:
- a string describing the sector change
-
getPath
Get the 2D path. This is comprised of all the 3D points in the trajectory that came from a swim that have been projected on to 2D.- Returns:
- the 2D path
-
addToFeedback
Add to the feedback strings- Parameters:
feedbackStrings
-
-
summaryString
Get a summary string for the trajectory- Returns:
- a summary string for the trajectory
-
closestDistance
Get the minimum distance to the trajectory.- Parameters:
wp
- the point in question.- Returns:
- the minimum distance from the point to the trajectory.
-
getTrajectory3D
- Returns:
- the trajectory3D
-
perpendicularDistance
public static double perpendicularDistance(Point2D.Double p0, Point2D.Double p1, Point2D.Double wp, Point2D.Double pintersect) Given two points p0 and p1, imagine a line from p0 to p1. Take the line to be parameterized by parameter t so that at t = 0 we are at p0 and t = 1 we are at p1.- Parameters:
p0
- start point of main linep1
- end point of main linewp
- the point from which we drop a perpendicular to p0 -> p1pintersect
- the intersection point of the perpendicular and the line containing p0-p1. It may or may not actually be between p0 and p1, as specified by the value of t.- Returns:
- the perpendicular distance to the line. If t is between 0 and 1 the intersection is on the line. If t < 0 the intersection is on the "infinite line" but not on p0->p1, it is on the p0 side; this returns the distance to p0. If t > 1 the intersection is on the p1 side; this returns the distance to p1.
-
getSource
Get the source of the trajectory, e.g., hbtracking- Returns:
- the source of the trajectory
-