Package cnuphys.swim

Class SwimTrajectory2D

java.lang.Object
cnuphys.swim.SwimTrajectory2D

public class SwimTrajectory2D extends Object
A 2D version of the 3D SwimTrajectory where all points have been projected onto a 2D plane.
Author:
heddle
  • Field Details

  • Constructor Details

    • SwimTrajectory2D

      public SwimTrajectory2D(SwimTrajectory trajectory, IProjector projector)
      Create a 2D trajectory from the 3D trajectory
      Parameters:
      trajectory - the 3D trajectory from a swim
      projector - 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

      public String sectorChangeString(int index)
      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

      public Point2D.Double[] 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

      public void addToFeedback(List<String> feedbackStrings)
      Add to the feedback strings
      Parameters:
      feedbackStrings -
    • summaryString

      public String summaryString()
      Get a summary string for the trajectory
      Returns:
      a summary string for the trajectory
    • closestDistance

      public double closestDistance(Point2D.Double wp)
      Get the minimum distance to the trajectory.
      Parameters:
      wp - the point in question.
      Returns:
      the minimum distance from the point to the trajectory.
    • getTrajectory3D

      public SwimTrajectory 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 line
      p1 - end point of main line
      wp - the point from which we drop a perpendicular to p0 -> p1
      pintersect - 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

      public String getSource()
      Get the source of the trajectory, e.g., hbtracking
      Returns:
      the source of the trajectory