Represents a 3D vector using three floats. More...
Inheritance diagram for com.mak.vrlj.math.Vector3f:
Collaboration diagram for com.mak.vrlj.math.Vector3f:Public Member Functions | |
| Vector3f () | |
| No-arg constructor. More... | |
| Vector3f (ConstVector3d other) | |
| Copy constructor from Vector3d. More... | |
| Vector3f (ConstVector3f other) | |
| Copy constructor. More... | |
| Vector3f (float x, float y, float z) | |
| Initializing constructor. More... | |
| void | add (ConstVector3f offset) |
| Add another vector to this and store the result in this. More... | |
| float | angle (ConstVector3f other) |
| Compute the angle between 2 vectors. More... | |
| void | assignFrom (ConstVector3d other) |
| Assign new values to this vector from a Vector3d. More... | |
| void | assignFrom (ConstVector3f other) |
| Assign new values to this vector from another. More... | |
| ConstMatrix3d | createFromAxisAngle (float angle) |
| Build a rotation matrix from the axis specified by this vector, and an angle rotation. More... | |
| ConstVector3f | cross (ConstVector3f other) |
| Cross product of 2 vectors. More... | |
| ConstVector3f | directedRotRateFromVec (double theta) |
| Build a rotation rate vector. More... | |
| float | distance (ConstVector3f p) |
| Get the distance between 2 3d points. More... | |
| float | dot (ConstVector3f other) |
| Dot product of 2 vectors. More... | |
| boolean | equals (Object obj) |
| float | get (int i) |
| Get vector component by index number, where i=0 for x, i=1 for y and i=2 for z. More... | |
| float | getLength () |
| Get the scalar length of this vector. More... | |
| float | getX () |
| Get the x component. More... | |
| float | getY () |
| Get the y component. More... | |
| float | getZ () |
| Get the z component. More... | |
| int | hashCode () |
| void | multiply (float scalar) |
| Multiply this vector by a scalar and store the result in this. More... | |
| void | normalize () |
| Adjust this vector so that the length is 1, but the direction is unchanged. More... | |
| void | set (int i, float v) |
| Set a vector component by index number, where i=0 for x, i=1 for y and i=2 for z. More... | |
| void | setX (float x) |
| void | setXYZ (float x, float y, float z) |
| Set all vector components. More... | |
| void | setY (float y) |
| void | setZ (float z) |
| void | subtract (ConstVector3f offset) |
| Subtract another vector from this and store the result in this. More... | |
| String | toString () |
| ConstVector3d | toVector3d () |
Static Public Attributes | |
| static final ConstVector3f | zero = new Vector3f(0.0f, 0.0f, 0.0f) |
| A vector with all components 0. More... | |
| static final ConstVector3f | unitX = new Vector3f(1.0f, 0.0f, 0.0f) |
| A unit vector along the x axis. More... | |
| static final ConstVector3f | unitY = new Vector3f(0.0f, 1.0f, 0.0f) |
| A unit vector along the y axis. More... | |
| static final ConstVector3f | unitZ = new Vector3f(0.0f, 0.0f, 1.0f) |
| A unit vector along the z axis. More... | |
Private Attributes | |
| float | myX |
| float | myY |
| float | myZ |
Represents a 3D vector using three floats.
|
inline |
No-arg constructor.
Referenced by com.mak.vrlj.math.Vector3f.cross(), com.mak.vrlj.math.Vector3f.directedRotRateFromVec(), and com.mak.vrlj.math.Vector3f.equals().
|
inline |
Copy constructor from Vector3d.
| 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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
Copy constructor.
| other | source for copy. |
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
Initializing constructor.
| x | component. |
| y | component. |
| z | component. |
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inlinevirtual |
Compute the angle between 2 vectors.
| other | vector. |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.dot(), and com.mak.vrlj.math.Vector3f.getLength().
|
inline |
Assign new values to this vector from a Vector3d.
| 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.Vector3f.setX(), com.mak.vrlj.math.Vector3f.setY(), and com.mak.vrlj.math.Vector3f.setZ().
|
inline |
Assign new values to this vector from another.
| 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.Vector3f.setX(), com.mak.vrlj.math.Vector3f.setY(), and com.mak.vrlj.math.Vector3f.setZ().
|
inlinevirtual |
Build a rotation matrix from the axis specified by this vector, and an angle rotation.
| angle | Angle in radians to rotate counter-clockwise (looking in the direction of the given axis). |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, com.mak.vrlj.math.Vector3f.myZ, and com.mak.vrlj.math.Vector3f.normalize().
|
inlinevirtual |
Cross product of 2 vectors.
| other | vector |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.ConstVector3f.getX(), com.mak.vrlj.math.ConstVector3f.getY(), com.mak.vrlj.math.ConstVector3f.getZ(), com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, com.mak.vrlj.math.Vector3f.myZ, and com.mak.vrlj.math.Vector3f.Vector3f().
|
inlinevirtual |
Build a rotation rate vector.
| theta | rotation rate |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, com.mak.vrlj.math.Vector3f.myZ, and com.mak.vrlj.math.Vector3f.Vector3f().
|
inlinevirtual |
Get the distance between 2 3d points.
| other | the other position for the difference. |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.getX(), com.mak.vrlj.math.Vector3f.getY(), and com.mak.vrlj.math.Vector3f.getZ().
|
inlinevirtual |
Dot product of 2 vectors.
| other | vector. |
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.ConstVector3f.getY(), com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.math.Vector3f.angle().
|
inline |
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, com.mak.vrlj.math.Vector3f.myZ, and com.mak.vrlj.math.Vector3f.Vector3f().
Referenced by com.mak.vrlj.coord.DeadReckoner.equals(), com.mak.vrlj.coord.Smoother.equals(), com.mak.vrlj.object.Entity.equals(), com.mak.vrlj.object.Emitter.equals(), and com.mak.vrlj.object.Iff.equals().
|
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.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.coord.Smoother.initSmootherParams().
|
inlinevirtual |
Get the scalar length of this vector.
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.math.Vector3f.angle(), and com.mak.vrlj.math.Vector3f.normalize().
|
inlinevirtual |
Get the x component.
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myX.
Referenced by com.mak.vrlj.math.Vector3f.distance(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inlinevirtual |
Get the y component.
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myY.
Referenced by com.mak.vrlj.math.Vector3f.distance(), and com.mak.vrlj.coord.Smoother.smoothPosition().
|
inlinevirtual |
Get the z component.
Implements com.mak.vrlj.math.ConstVector3f.
References com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.math.Vector3f.distance(), 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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
Adjust this vector so that the length is 1, but the direction is unchanged.
References com.mak.vrlj.math.Vector3f.getLength(), com.mak.vrlj.math.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.math.Vector3f.createFromAxisAngle().
|
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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
| x | new value for x component. |
References com.mak.vrlj.math.Vector3f.myX.
Referenced by com.mak.vrlj.math.Vector3f.assignFrom().
|
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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
| y | new value for y component. |
References com.mak.vrlj.math.Vector3f.myY.
Referenced by com.mak.vrlj.math.Vector3f.assignFrom().
|
inline |
| z | new value for z component. |
References com.mak.vrlj.math.Vector3f.myZ.
Referenced by com.mak.vrlj.math.Vector3f.assignFrom().
|
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.Vector3f.myX, com.mak.vrlj.math.Vector3f.myY, and com.mak.vrlj.math.Vector3f.myZ.
|
inline |
|
inlinevirtual |
Implements com.mak.vrlj.math.ConstVector3f.
|
private |
Referenced by com.mak.vrlj.math.Vector3f.add(), com.mak.vrlj.math.Vector3f.createFromAxisAngle(), com.mak.vrlj.math.Vector3f.cross(), com.mak.vrlj.math.Vector3f.directedRotRateFromVec(), com.mak.vrlj.math.Vector3f.dot(), com.mak.vrlj.math.Vector3f.equals(), com.mak.vrlj.math.Vector3f.get(), com.mak.vrlj.math.Vector3f.getLength(), com.mak.vrlj.math.Vector3f.getX(), com.mak.vrlj.math.Vector3f.hashCode(), com.mak.vrlj.math.Vector3f.multiply(), com.mak.vrlj.math.Vector3f.normalize(), com.mak.vrlj.math.Vector3f.set(), com.mak.vrlj.math.Vector3f.setX(), com.mak.vrlj.math.Vector3f.setXYZ(), com.mak.vrlj.math.Vector3f.subtract(), com.mak.vrlj.math.Vector3f.toString(), and com.mak.vrlj.math.Vector3f.Vector3f().
|
private |
Referenced by com.mak.vrlj.math.Vector3f.add(), com.mak.vrlj.math.Vector3f.createFromAxisAngle(), com.mak.vrlj.math.Vector3f.cross(), com.mak.vrlj.math.Vector3f.directedRotRateFromVec(), com.mak.vrlj.math.Vector3f.dot(), com.mak.vrlj.math.Vector3f.equals(), com.mak.vrlj.math.Vector3f.get(), com.mak.vrlj.math.Vector3f.getLength(), com.mak.vrlj.math.Vector3f.getY(), com.mak.vrlj.math.Vector3f.hashCode(), com.mak.vrlj.math.Vector3f.multiply(), com.mak.vrlj.math.Vector3f.normalize(), com.mak.vrlj.math.Vector3f.set(), com.mak.vrlj.math.Vector3f.setXYZ(), com.mak.vrlj.math.Vector3f.setY(), com.mak.vrlj.math.Vector3f.subtract(), com.mak.vrlj.math.Vector3f.toString(), and com.mak.vrlj.math.Vector3f.Vector3f().
|
private |
Referenced by com.mak.vrlj.math.Vector3f.add(), com.mak.vrlj.math.Vector3f.createFromAxisAngle(), com.mak.vrlj.math.Vector3f.cross(), com.mak.vrlj.math.Vector3f.directedRotRateFromVec(), com.mak.vrlj.math.Vector3f.dot(), com.mak.vrlj.math.Vector3f.equals(), com.mak.vrlj.math.Vector3f.get(), com.mak.vrlj.math.Vector3f.getLength(), com.mak.vrlj.math.Vector3f.getZ(), com.mak.vrlj.math.Vector3f.hashCode(), com.mak.vrlj.math.Vector3f.multiply(), com.mak.vrlj.math.Vector3f.normalize(), com.mak.vrlj.math.Vector3f.set(), com.mak.vrlj.math.Vector3f.setXYZ(), com.mak.vrlj.math.Vector3f.setZ(), com.mak.vrlj.math.Vector3f.subtract(), com.mak.vrlj.math.Vector3f.toString(), and com.mak.vrlj.math.Vector3f.Vector3f().
|
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.example.f18.VehicleSim.detonateMunition(), and com.mak.vrlj.example.f18.VehicleSim.reactToDamage().