public class Rotation2d extends java.lang.Object implements Interpolable<Rotation2d>
Constructor and Description |
---|
Rotation2d() |
Rotation2d(double x,
double y,
boolean normalize) |
Rotation2d(Rotation2d other) |
Rotation2d(Translation2d direction,
boolean normalize) |
Modifier and Type | Method and Description |
---|---|
double |
cos() |
static Rotation2d |
fromDegrees(double angle_degrees) |
static Rotation2d |
fromRadians(double angle_radians) |
double |
getDegrees() |
double |
getRadians() |
static Rotation2d |
identity() |
Rotation2d |
interpolate(Rotation2d other,
double x)
Interpolates between this value and an other value according to a given parameter.
|
Rotation2d |
inverse()
The inverse of a Rotation2d "undoes" the effect of this rotation.
|
boolean |
isParallel(Rotation2d other) |
Rotation2d |
normal() |
void |
normalize()
From trig, we know that sin^2 + cos^2 == 1, but as we do math on this object we might accumulate rounding errors.
|
Rotation2d |
rotateBy(Rotation2d other)
We can rotate this Rotation2d by adding together the effects of it and another rotation.
|
double |
sin() |
double |
tan() |
java.lang.String |
toString() |
Translation2d |
toTranslation() |
public Rotation2d()
public Rotation2d(double x, double y, boolean normalize)
public Rotation2d(Rotation2d other)
public Rotation2d(Translation2d direction, boolean normalize)
public static final Rotation2d identity()
public static Rotation2d fromRadians(double angle_radians)
public static Rotation2d fromDegrees(double angle_degrees)
public void normalize()
public double cos()
public double sin()
public double tan()
public double getRadians()
public double getDegrees()
public Rotation2d rotateBy(Rotation2d other)
other
- The other rotation. See: https://en.wikipedia.org/wiki/Rotation_matrixpublic Rotation2d normal()
public Rotation2d inverse()
public boolean isParallel(Rotation2d other)
public Translation2d toTranslation()
public Rotation2d interpolate(Rotation2d other, double x)
Interpolable
interpolate
in interface Interpolable<Rotation2d>
other
- The value of the upper boundx
- The requested value. Should be between 0 and 1.public java.lang.String toString()
toString
in class java.lang.Object