Package frc.team1711.swerve.util
Class Angles
- java.lang.Object
-
- frc.team1711.swerve.util.Angles
-
public class Angles extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Angles()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubledegreesToRadians(double degrees)Converts a rotation in degrees to radians, where the radians starts directly right of the origin on the x axis and progresses counterclockwise, and degrees starts directly above the origin on the y axis and progresses clockwise.static doubleradiansToDegrees(double radians)Converts a rotation in radians to degrees, where the radians starts at directly right of the origin on the x axis and progresses counterclockwise, and degrees starts directly above the origin on the y axis and progresses clockwise.static doublewrapDegrees(double degrees)Wrapsdegreesto be on the interval [0, 360).static doublewrapDegreesZeroCenter(double degrees)Wrapsdegreesto be on the interval [-180, 180).static doublewrapRadians(double radians)Wrapsradiansto be on the interval [0, 2pi).static doublewrapRadiansZeroCenter(double radians)Wrapsradiansto be on the interval [-pi, pi).
-
-
-
Field Detail
-
PI
public static double PI
The circle constant pi; the ratio from a circle's circumference to its diameter. Equal to one half ofTAU. Also equal to the number of radians in half a revolution.
-
TAU
public static double TAU
The circle constant tau; the ratio from a circle's circumference to its radius. Equal toPItimes two. Also equal to the number of radians in a complete revolution.
-
-
Method Detail
-
wrapDegrees
public static double wrapDegrees(double degrees)
Wrapsdegreesto be on the interval [0, 360).- Parameters:
degrees- The unwrapped degrees- Returns:
- The degrees, wrapped between 0 and 360
-
wrapDegreesZeroCenter
public static double wrapDegreesZeroCenter(double degrees)
Wrapsdegreesto be on the interval [-180, 180).- Parameters:
degrees- The unwrapped degrees- Returns:
- The degrees, wrapped between -180 and 180
-
wrapRadians
public static double wrapRadians(double radians)
Wrapsradiansto be on the interval [0, 2pi).- Parameters:
radians- The unwrapped radians- Returns:
- The radians, wrapped between 0 and 2pi
-
wrapRadiansZeroCenter
public static double wrapRadiansZeroCenter(double radians)
Wrapsradiansto be on the interval [-pi, pi).- Parameters:
radians- The unwrapped radians- Returns:
- The radians, wrapped between -pi and pi
-
radiansToDegrees
public static double radiansToDegrees(double radians)
Converts a rotation in radians to degrees, where the radians starts at directly right of the origin on the x axis and progresses counterclockwise, and degrees starts directly above the origin on the y axis and progresses clockwise.- Parameters:
radians- The radians to convert to degrees- Returns:
- The degrees converted from radians
-
degreesToRadians
public static double degreesToRadians(double degrees)
Converts a rotation in degrees to radians, where the radians starts directly right of the origin on the x axis and progresses counterclockwise, and degrees starts directly above the origin on the y axis and progresses clockwise.- Parameters:
degrees- The degrees to convert to radians- Returns:
- The radians converted from degrees
-
-