Represents a 3D vector using three doubles. More...
Inheritance diagram for com.mak.vrlj.math.Vector3d:
Collaboration diagram for com.mak.vrlj.math.Vector3d:Public Member Functions | |
| Vector3d () | |
| No-arg constructor. | |
| Vector3d (ConstVector3d other) | |
| Copy constructor. | |
| Vector3d (ConstVector3f other) | |
| Copy constructor from Vector3f. | |
| Vector3d (double x, double y, double z) | |
| Initializing constructor. | |
| void | add (ConstVector3d offset) |
| Add another vector to this and store the result in this. | |
| double | angle (ConstVector3d other) |
| Compute the angle between 2 vectors. | |
| void | assignFrom (ConstVector3d other) |
| Assign new values to this vector from another. | |
| void | assignFrom (ConstVector3f other) |
| Assign new values to this vector from a Vector3f. | |
| Vector3d | cross (ConstVector3d other) |
| Cross product of 2 vectors. | |
| double | distance (ConstVector3d p) |
| Get the distance between 2 3d points. | |
| double | dot (ConstVector3d other) |
| Dot product of 2 vectors. | |
| boolean | equals (Object obj) |
| double | get (int i) |
| Get vector component by index number, where i=0 for x, i=1 for y and i=2 for z. | |
| double | getLength () |
| Get the scalar length of this vector. | |
| double | getX () |
| Get the x component. | |
| double | getY () |
| Get the y component. | |
| double | getZ () |
| Get the z component. | |
| int | hashCode () |
| void | multiply (double scalar) |
| Multiply this vector by a scalar and store the result in this. | |
| void | normalize () |
| Adjust this vector so that the length is 1, but the direction is unchanged. | |
| void | set (int i, double v) |
| Set a vector component by index number, where i=0 for x, i=1 for y and i=2 for z. | |
| void | setX (double x) |
| void | setXYZ (double x, double y, double z) |
| Set all vector components. | |
| void | setY (double y) |
| void | setZ (double z) |
| void | subtract (ConstVector3d offset) |
| Subtract another vector from this and store the result in this. | |
| String | toString () |
| ConstVector3f | toVector3f () |
Static Public Attributes | |
| static final ConstVector3d | zero = new Vector3d(0.0, 0.0, 0.0) |
| A vector with all components 0. | |
| static final ConstVector3d | unitX = new Vector3d(1.0, 0.0, 0.0) |
| A unit vector along the x axis. | |
| static final ConstVector3d | unitY = new Vector3d(0.0, 1.0, 0.0) |
| A unit vector along the y axis. | |
| static final ConstVector3d | unitZ = new Vector3d(0.0, 0.0, 1.0) |
| A unit vector along the z axis. | |
Private Attributes | |
| double | myX |
| double | myY |
| double | myZ |
Represents a 3D vector using three doubles.
|
inline |
No-arg constructor.
Referenced by com.mak.vrlj.math.Vector3d.cross(), and com.mak.vrlj.math.Vector3d.equals().
|
inline |
Copy constructor.
| other | source for copy. |
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
|
inline |
Copy constructor from Vector3f.
| other | source for copy. |
References com.mak.vrlj.math.ConstVector3f.getX(), com.mak.vrlj.math.ConstVector3f.getY(), com.mak.vrlj.math.ConstVector3f.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
|
inline |
Initializing constructor.
| x | component. |
| y | component. |
| z | component. |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
|
inline |
Add another vector to this and store the result in this.
| offset | the value to add to this vector. |
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.talk.Talk.main().
|
inlinevirtual |
Compute the angle between 2 vectors.
| other |
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.dot(), com.mak.vrlj.math.ConstVector3d.getLength(), and com.mak.vrlj.math.Vector3d.getLength().
|
inline |
Assign new values to this vector from another.
| other | source for assignment. |
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.setX(), com.mak.vrlj.math.Vector3d.setY(), and com.mak.vrlj.math.Vector3d.setZ().
Referenced by com.mak.vrlj.coord.DeadReckoner.deadReckonPosition(), com.mak.vrlj.example.f18.VehicleSim.init(), com.mak.vrlj.example.talk.Talk.main(), com.mak.vrlj.coord.Smoother.resetPosSmoother(), com.mak.vrlj.coord.DeadReckoner.setAcceleration(), com.mak.vrlj.coord.CoordinateTransform.setOffset(), com.mak.vrlj.coord.DeadReckoner.setPosition(), com.mak.vrlj.coord.DeadReckoner.setPositionAtTimeOfValidity(), com.mak.vrlj.coord.DeadReckoner.setVelocity(), com.mak.vrlj.object.Entity.setWorldPosition(), and com.mak.vrlj.coord.CoordinateTransform.transform().
|
inline |
Assign new values to this vector from a Vector3f.
| other | source for assignment. |
References com.mak.vrlj.math.ConstVector3f.getX(), com.mak.vrlj.math.ConstVector3f.getY(), com.mak.vrlj.math.ConstVector3f.getZ(), com.mak.vrlj.math.Vector3d.setX(), com.mak.vrlj.math.Vector3d.setY(), and com.mak.vrlj.math.Vector3d.setZ().
|
inlinevirtual |
Cross product of 2 vectors.
| other |
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, com.mak.vrlj.math.Vector3d.myZ, com.mak.vrlj.math.Vector3d.setX(), com.mak.vrlj.math.Vector3d.setY(), com.mak.vrlj.math.Vector3d.setZ(), and com.mak.vrlj.math.Vector3d.Vector3d().
|
inlinevirtual |
Get the distance between 2 3d points.
| other | the other position for the difference. |
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.Vector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.Vector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), and com.mak.vrlj.math.Vector3d.getZ().
Referenced by com.mak.vrlj.example.f18.VehicleSim.nearestEntity().
|
inlinevirtual |
Dot product of 2 vectors.
| other |
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.math.Vector3d.angle().
|
inline |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, com.mak.vrlj.math.Vector3d.myZ, and com.mak.vrlj.math.Vector3d.Vector3d().
Referenced by com.mak.vrlj.coord.CoordinateTransform.equals(), com.mak.vrlj.coord.DeadReckoner.equals(), com.mak.vrlj.coord.Smoother.equals(), com.mak.vrlj.coord.UtmCoordinate.equals(), com.mak.vrlj.object.Entity.equals(), and com.mak.vrlj.coord.Smoother.resetPosSmoother().
|
inlinevirtual |
Get vector component by index number, where i=0 for x, i=1 for y and i=2 for z.
| i | index of which vector component to set. |
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.coord.Smoother.initSmootherParams(), and com.mak.vrlj.example.f18.VehicleSim.simTick().
|
inlinevirtual |
Get the scalar length of this vector.
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.math.Vector3d.angle(), com.mak.vrlj.example.f18.VehicleSim.checkDetonation(), and com.mak.vrlj.math.Vector3d.normalize().
|
inlinevirtual |
Get the x component.
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.myX.
Referenced by com.mak.vrlj.example.f18.VehicleSim.detonateMunition(), com.mak.vrlj.math.Vector3d.distance(), com.mak.vrlj.coord.UtmCoordinate.getEast(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.Smoother.smoothBodyToGeoc(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inlinevirtual |
Get the y component.
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.myY.
Referenced by com.mak.vrlj.example.f18.VehicleSim.detonateMunition(), com.mak.vrlj.math.Vector3d.distance(), com.mak.vrlj.coord.UtmCoordinate.getNorth(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.Smoother.smoothBodyToGeoc(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inlinevirtual |
Get the z component.
Implements com.mak.vrlj.math.ConstVector3d.
References com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.f18.VehicleSim.detonateMunition(), com.mak.vrlj.math.Vector3d.distance(), com.mak.vrlj.coord.UtmCoordinate.getUp(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.Smoother.smoothBodyToGeoc(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inline |
|
inline |
Multiply this vector by a scalar and store the result in this.
| scalar | the value to add to this vector. |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.talk.Talk.main().
|
inline |
Adjust this vector so that the length is 1, but the direction is unchanged.
References com.mak.vrlj.math.Vector3d.getLength(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
|
inline |
Set a vector component by index number, where i=0 for x, i=1 for y and i=2 for z.
| i | index of which vector component to set. |
| v | the new value for the indexed component. |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.coord.Smoother.initSmootherParams(), and com.mak.vrlj.example.f18.VehicleSim.simTick().
|
inline |
| x | new value for x component. |
References com.mak.vrlj.math.Vector3d.myX.
Referenced by com.mak.vrlj.math.Vector3d.assignFrom(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.coord.DeadReckoner.deadReckonPosition(), com.mak.vrlj.coord.ReferenceEllipsoid.geodeticToGeocentric(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.math.Matrix3d.postMultiplyByVector(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.UtmCoordinate.setEast(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inline |
Set all vector components.
| x | new value for x component. |
| y | new value for y component. |
| z | new value for z component. |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.talk.Talk.main().
|
inline |
| y | new value for y component. |
References com.mak.vrlj.math.Vector3d.myY.
Referenced by com.mak.vrlj.math.Vector3d.assignFrom(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.coord.DeadReckoner.deadReckonPosition(), com.mak.vrlj.coord.ReferenceEllipsoid.geodeticToGeocentric(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.math.Matrix3d.postMultiplyByVector(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.UtmCoordinate.setNorth(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inline |
| z | new value for z component. |
References com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.math.Vector3d.assignFrom(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.coord.DeadReckoner.deadReckonPosition(), com.mak.vrlj.coord.ReferenceEllipsoid.geodeticToGeocentric(), com.mak.vrlj.coord.Smoother.initSmoothOriParams(), com.mak.vrlj.math.Matrix3d.postMultiplyByVector(), com.mak.vrlj.coord.Smoother.rotAngleAndAxisFromRotMatrix(), com.mak.vrlj.coord.Smoother.rotMatrixFromRotRatesAndTime(), com.mak.vrlj.coord.UtmCoordinate.setUp(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inline |
Subtract another vector from this and store the result in this.
| offset | the value to subtract from this vector. |
References com.mak.vrlj.math.ConstVector3d.getX(), com.mak.vrlj.math.ConstVector3d.getY(), com.mak.vrlj.math.ConstVector3d.getZ(), com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.f18.VehicleSim.checkDetonation(), com.mak.vrlj.example.f18.VehicleSim.detonateMunition(), and com.mak.vrlj.coord.CoordinateTransform.transform().
|
inline |
References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.
Referenced by com.mak.vrlj.example.listen.Listen.main().
|
inlinevirtual |
Implements com.mak.vrlj.math.ConstVector3d.
|
private |
Referenced by com.mak.vrlj.math.Vector3d.add(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.math.Vector3d.dot(), com.mak.vrlj.math.Vector3d.equals(), com.mak.vrlj.math.Vector3d.get(), com.mak.vrlj.math.Vector3d.getLength(), com.mak.vrlj.math.Vector3d.getX(), com.mak.vrlj.math.Vector3d.hashCode(), com.mak.vrlj.math.Vector3d.multiply(), com.mak.vrlj.math.Vector3d.normalize(), com.mak.vrlj.math.Vector3d.set(), com.mak.vrlj.math.Vector3d.setX(), com.mak.vrlj.math.Vector3d.setXYZ(), com.mak.vrlj.math.Vector3d.subtract(), com.mak.vrlj.math.Vector3d.toString(), and com.mak.vrlj.math.Vector3d.Vector3d().
|
private |
Referenced by com.mak.vrlj.math.Vector3d.add(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.math.Vector3d.dot(), com.mak.vrlj.math.Vector3d.equals(), com.mak.vrlj.math.Vector3d.get(), com.mak.vrlj.math.Vector3d.getLength(), com.mak.vrlj.math.Vector3d.getY(), com.mak.vrlj.math.Vector3d.hashCode(), com.mak.vrlj.math.Vector3d.multiply(), com.mak.vrlj.math.Vector3d.normalize(), com.mak.vrlj.math.Vector3d.set(), com.mak.vrlj.math.Vector3d.setXYZ(), com.mak.vrlj.math.Vector3d.setY(), com.mak.vrlj.math.Vector3d.subtract(), com.mak.vrlj.math.Vector3d.toString(), and com.mak.vrlj.math.Vector3d.Vector3d().
|
private |
Referenced by com.mak.vrlj.math.Vector3d.add(), com.mak.vrlj.math.Vector3d.cross(), com.mak.vrlj.math.Vector3d.dot(), com.mak.vrlj.math.Vector3d.equals(), com.mak.vrlj.math.Vector3d.get(), com.mak.vrlj.math.Vector3d.getLength(), com.mak.vrlj.math.Vector3d.getZ(), com.mak.vrlj.math.Vector3d.hashCode(), com.mak.vrlj.math.Vector3d.multiply(), com.mak.vrlj.math.Vector3d.normalize(), com.mak.vrlj.math.Vector3d.set(), com.mak.vrlj.math.Vector3d.setXYZ(), com.mak.vrlj.math.Vector3d.setZ(), com.mak.vrlj.math.Vector3d.subtract(), com.mak.vrlj.math.Vector3d.toString(), and com.mak.vrlj.math.Vector3d.Vector3d().
|
static |
A unit vector along the x axis.
|
static |
A unit vector along the y axis.
|
static |
A unit vector along the z axis.
|
static |
A vector with all components 0.
Referenced by com.mak.vrlj.coord.CoordinateTransform.getInverse(), and com.mak.vrlj.coord.Smoother.resetPosSmoother().