Package frc.lib.math

Class Axis

java.lang.Object
frc.lib.math.Axis

public class Axis extends Object
Represents an axis.
  • Constructor Details

    • Axis

      public Axis(double xDir, double yDir)
      Create new axis with a given direction. Either xDir or yDir must be non-zero.
  • Method Details

    • fromRotation

      public static Axis fromRotation(Rotation2d rot)
      Create an axis with the same direction as the given rotation.
    • setFromRotation

      public void setFromRotation(Rotation2d rot)
      Set axis direction to the same direction as the given rotation.
    • unaryMinus

      public Axis unaryMinus()
      Get opposite direction. Is equivalent as far as the definition of an axis is concerned, but for implementation purposes, has a negative direction.
    • getX

      public double getX()
      Get the X direction.
    • getY

      public double getY()
      Get the Y direction.
    • setDirection

      public void setDirection(double xDir, double yDir)
      Set the direction. Either xDir or yDir must be non-zero.
    • dot

      public double dot(Translation2d point)
      Get the dot product between this direction and a given point.
    • project

      public Interval project(Translation2d[] points)
      Project multiple points onto this axis.