public class Translation2d extends java.lang.Object implements Interpolable<Translation2d>
Modifier and Type | Field and Description |
---|---|
protected double |
x_ |
protected double |
y_ |
Constructor and Description |
---|
Translation2d() |
Translation2d(double x,
double y) |
Translation2d(Translation2d other) |
Modifier and Type | Method and Description |
---|---|
Translation2d |
extrapolate(Translation2d other,
double x) |
double |
getX() |
double |
getY() |
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.
|
Translation2d |
rotateBy(Rotation2d rotation)
We can also rotate Translation2d'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.
|
public Translation2d()
public Translation2d(double x, double y)
public Translation2d(Translation2d other)
public double norm()
public double getX()
public double getY()
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 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 java.lang.String toString()
toString
in class java.lang.Object