Package frc.lib.math
Class Axis
java.lang.Object
frc.lib.math.Axis
Represents an axis.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
dot
(Translation2d point) Get the dot product between this direction and a given point.static Axis
fromRotation
(Rotation2d rot) Create an axis with the same direction as the given rotation.double
getX()
Get the X direction.double
getY()
Get the Y direction.project
(Translation2d[] points) Project multiple points onto this axis.void
setDirection
(double xDir, double yDir) Set the direction.void
Set axis direction to the same direction as the given rotation.Get opposite direction.
-
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
Create an axis with the same direction as the given rotation. -
setFromRotation
Set axis direction to the same direction as the given rotation. -
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
Get the dot product between this direction and a given point. -
project
Project multiple points onto this axis.
-