public class Translation2d extends java.lang.Object implements Interpolable<Translation2d>
Constructor and Description |
---|
Translation2d() |
Translation2d(double x,
double y) |
Translation2d(Translation2d other) |
Translation2d(Translation2d start,
Translation2d end) |
Modifier and Type | Method and Description |
---|---|
static double |
cross(Translation2d a,
Translation2d b) |
Rotation2d |
direction() |
static double |
dot(Translation2d a,
Translation2d b) |
Translation2d |
extrapolate(Translation2d other,
double x) |
static Rotation2d |
getAngle(Translation2d a,
Translation2d b) |
static Translation2d |
identity() |
Translation2d |
interpolate(Translation2d other,
double x)
Interpolates between this value and an other value according to a given parameter.
|
Translation2d |
inverse()
The inverse simply means a Translation2d that "undoes" this object.
|
double |
norm()
The "norm" of a transform is the Euclidean distance in x and y.
|
double |
norm2() |
Translation2d |
rotateBy(Rotation2d rotation)
We can also rotate Translation2d's.
|
Translation2d |
scale(double s) |
void |
setX(double x) |
void |
setY(double y) |
java.lang.String |
toString() |
Translation2d |
translateBy(Translation2d other)
We can compose Translation2d's by adding together the x and y shifts.
|
double |
x() |
double |
y() |
public Translation2d()
public Translation2d(double x, double y)
public Translation2d(Translation2d other)
public Translation2d(Translation2d start, Translation2d end)
public static final Translation2d identity()
public double norm()
public double norm2()
public double x()
public double y()
public void setX(double x)
public void setY(double y)
public Translation2d translateBy(Translation2d other)
other
- The other translation to add.public Translation2d rotateBy(Rotation2d rotation)
rotation
- The rotation to apply.public Rotation2d direction()
public Translation2d inverse()
public Translation2d interpolate(Translation2d other, double x)
Interpolable
interpolate
in interface Interpolable<Translation2d>
other
- The value of the upper boundx
- The requested value. Should be between 0 and 1.public Translation2d extrapolate(Translation2d other, double x)
public Translation2d scale(double s)
public java.lang.String toString()
toString
in class java.lang.Object
public static double dot(Translation2d a, Translation2d b)
public static Rotation2d getAngle(Translation2d a, Translation2d b)
public static double cross(Translation2d a, Translation2d b)