VR-Link JAVA API Documentation
 All Classes Namespaces Files Functions Variables Enumerator Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
com.mak.vrlj.math.Vector3d Class Reference

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

Detailed Description

Represents a 3D vector using three doubles.

Constructor & Destructor Documentation

com.mak.vrlj.math.Vector3d.Vector3d ( )
inline
com.mak.vrlj.math.Vector3d.Vector3d ( ConstVector3d  other)
inline
com.mak.vrlj.math.Vector3d.Vector3d ( ConstVector3f  other)
inline
com.mak.vrlj.math.Vector3d.Vector3d ( double  x,
double  y,
double  z 
)
inline

Initializing constructor.

Parameters
xcomponent.
ycomponent.
zcomponent.

References com.mak.vrlj.math.Vector3d.myX, com.mak.vrlj.math.Vector3d.myY, and com.mak.vrlj.math.Vector3d.myZ.

Member Function Documentation

void com.mak.vrlj.math.Vector3d.add ( ConstVector3d  offset)
inline
double com.mak.vrlj.math.Vector3d.angle ( ConstVector3d  other)
inlinevirtual

Compute the angle between 2 vectors.

Parameters
other
Returns
the angle between the vectors, in radians.

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().

void com.mak.vrlj.math.Vector3d.assignFrom ( ConstVector3d  other)
inline
void com.mak.vrlj.math.Vector3d.assignFrom ( ConstVector3f  other)
inline
Vector3d com.mak.vrlj.math.Vector3d.cross ( ConstVector3d  other)
inlinevirtual
double com.mak.vrlj.math.Vector3d.distance ( ConstVector3d  other)
inlinevirtual

Get the distance between 2 3d points.

Parameters
otherthe other position for the difference.
Returns
the scalar distance between 2 3d points.

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().

double com.mak.vrlj.math.Vector3d.dot ( ConstVector3d  other)
inlinevirtual
boolean com.mak.vrlj.math.Vector3d.equals ( Object  obj)
inline
double com.mak.vrlj.math.Vector3d.get ( int  i)
inlinevirtual

Get vector component by index number, where i=0 for x, i=1 for y and i=2 for z.

Parameters
iindex of which vector component to set.
Returns
the value of the indexed component.

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().

double com.mak.vrlj.math.Vector3d.getLength ( )
inlinevirtual
double com.mak.vrlj.math.Vector3d.getX ( )
inlinevirtual
double com.mak.vrlj.math.Vector3d.getY ( )
inlinevirtual
double com.mak.vrlj.math.Vector3d.getZ ( )
inlinevirtual
int com.mak.vrlj.math.Vector3d.hashCode ( )
inline
void com.mak.vrlj.math.Vector3d.multiply ( double  scalar)
inline

Multiply this vector by a scalar and store the result in this.

Parameters
scalarthe 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().

void com.mak.vrlj.math.Vector3d.normalize ( )
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.

void com.mak.vrlj.math.Vector3d.set ( int  i,
double  v 
)
inline

Set a vector component by index number, where i=0 for x, i=1 for y and i=2 for z.

Parameters
iindex of which vector component to set.
vthe 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().

void com.mak.vrlj.math.Vector3d.setX ( double  x)
inline
void com.mak.vrlj.math.Vector3d.setXYZ ( double  x,
double  y,
double  z 
)
inline

Set all vector components.

Parameters
xnew value for x component.
ynew value for y component.
znew 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().

void com.mak.vrlj.math.Vector3d.setY ( double  y)
inline
void com.mak.vrlj.math.Vector3d.setZ ( double  z)
inline
void com.mak.vrlj.math.Vector3d.subtract ( ConstVector3d  offset)
inline
String com.mak.vrlj.math.Vector3d.toString ( )
inline
ConstVector3f com.mak.vrlj.math.Vector3d.toVector3f ( )
inlinevirtual
Returns
a Vector3f equal to this vector (except loss of precision to to double-to-float conversion).

Implements com.mak.vrlj.math.ConstVector3d.

Member Data Documentation

double com.mak.vrlj.math.Vector3d.myX
private
double com.mak.vrlj.math.Vector3d.myY
private
double com.mak.vrlj.math.Vector3d.myZ
private
final ConstVector3d com.mak.vrlj.math.Vector3d.unitX = new Vector3d(1.0, 0.0, 0.0)
static

A unit vector along the x axis.

final ConstVector3d com.mak.vrlj.math.Vector3d.unitY = new Vector3d(0.0, 1.0, 0.0)
static

A unit vector along the y axis.

final ConstVector3d com.mak.vrlj.math.Vector3d.unitZ = new Vector3d(0.0, 0.0, 1.0)
static

A unit vector along the z axis.

final ConstVector3d com.mak.vrlj.math.Vector3d.zero = new Vector3d(0.0, 0.0, 0.0)
static

The documentation for this class was generated from the following file:

Document ID: Generated on Mon Jun 22 21:18:40 EDT 2020 from SVN revision 213785
Copyright © 2005-2018 MAK Technologies. All Rights Reserved (www.mak.com)