IOrientation
, IOrientation2D
, java.io.Serializable
public class Orientation2D extends java.lang.Object implements IOrientation2D, java.io.Serializable
Modifier and Type | Field | Description |
---|---|---|
protected double |
angle |
|
protected Vector |
direction |
Constructor | Description |
---|---|
Orientation2D() |
Default constructor sets orientation angle to zero.
|
Orientation2D(Vector direction) |
Constructs with orientation as specified by the given angle theta.
|
Modifier and Type | Method | Description |
---|---|---|
void |
E(IOrientation o) |
Copies the given orientation to this one.
|
Vector |
getDirection() |
|
void |
randomRotation(IRandom random,
double tStep) |
Applies a random rotation of angle selected uniformly within plus or minus tStep
from the current value.
|
void |
rotateBy(double dt) |
Rotates orientation around the given axis by the given value.
|
void |
setDirection(Vector newDirection) |
Sets this orientation to point in the given direction.
|
protected double angle
protected Vector direction
public Orientation2D()
public Orientation2D(Vector direction)
java.lang.Exception
- if vector has 0 lengthpublic void E(IOrientation o)
IOrientation
E
in interface IOrientation
o
- the new orientationpublic Vector getDirection()
getDirection
in interface IOrientation
public void setDirection(Vector newDirection)
IOrientation
setDirection
in interface IOrientation
newDirection
- the new direction for this orientationpublic void rotateBy(double dt)
rotateBy
in interface IOrientation2D
public void randomRotation(IRandom random, double tStep)
randomRotation
in interface IOrientation
random
- random number generator used to select the angletStep
- the maximum angle (in radians) for random rotation