IOrientation
, IOrientation3D
, IOrientationFull3D
, java.io.Serializable
public class OrientationFull3D extends java.lang.Object implements IOrientationFull3D, java.io.Serializable
Modifier and Type | Field | Description |
---|---|---|
protected Vector |
direction |
|
protected Tensor3D |
rotationTensor |
|
protected Vector |
secondaryDirection |
|
protected Vector |
v2 |
|
protected Vector |
v3 |
Constructor | Description |
---|---|
OrientationFull3D(Space space) |
Default constructor sets orientation to point in the X direction.
|
Modifier and Type | Method | Description |
---|---|---|
void |
E(IOrientation o) |
Copies the given orientation to this one.
|
Vector |
getDirection() |
|
Vector |
getSecondaryDirection() |
Returns a unit vector pointing in the orientation's secondary direction.
|
void |
randomRotation(IRandom random,
double tStep) |
Applies a random rotation of angle selected uniformly from 0 to tStep.
|
void |
relax() |
Normalizes both direction and secondaryDirection
|
void |
rotateBy(double dt,
Vector axis) |
Rotates orientation by the given value about the given axis.
|
void |
setDirection(Vector newDirection) |
Sets this orientation to point in the given direction.
|
void |
setDirections(Vector newPrimaryDirection,
Vector newSecondaryDirection) |
Sets the orientation's primary and secondary direction to be the given
directions.
|
protected final Vector direction
protected final Vector secondaryDirection
protected final Vector v2
protected final Vector v3
protected final Tensor3D rotationTensor
public OrientationFull3D(Space space)
public void E(IOrientation o)
IOrientation
E
in interface IOrientation
o
- the new orientationpublic Vector getDirection()
getDirection
in interface IOrientation
public Vector getSecondaryDirection()
IOrientationFull3D
getSecondaryDirection
in interface IOrientationFull3D
public void setDirection(Vector newDirection)
setDirection
in interface IOrientation
newDirection
- the new direction for this orientationjava.lang.Exception
- if vector has 0 lengthpublic void setDirections(Vector newPrimaryDirection, Vector newSecondaryDirection)
IOrientationFull3D
setDirections
in interface IOrientationFull3D
public void rotateBy(double dt, Vector axis)
rotateBy
in interface IOrientation3D
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 rotationpublic void relax()