Fork me
BeyondAR
Augmented Reality Framework for Android
 All Classes Functions Variables
com.beyondar.android.util.math.geom.Vector3 Class Reference

Represents a 3 dimensions vector. More...

Inheritance diagram for com.beyondar.android.util.math.geom.Vector3:
Collaboration diagram for com.beyondar.android.util.math.geom.Vector3:

Public Member Functions

 Vector3 (float x, float y, float z)
 Constructs a vector from its 3 coordinates. More...
 
 Vector3 ()
 Constructs a vector from its 3 coordinates.
 
 Vector3 (Point3 p1, Point3 p2)
 Constructs a vector that points from p1 to p2. More...
 
 Vector3 (Point3 v)
 Constructs a vector from another vector. More...
 
void set (float x, float y, float z)
 
float dotProduct (Vector3 v)
 Returns the dot product with the given vector. More...
 
float module ()
 Returns vector module. More...
 
float module2 ()
 Returns module's square, avoiding do the square root. More...
 
float angle (Vector3 v)
 Returns the formed angle with the given vector. More...
 
Vector3 crossProduct (Vector3 v)
 Returns the cross product with the given vector. More...
 
void normalize ()
 Normalize the vector.
 
int getGreatestComponent ()
 Returns the index from the vector's greatest absolute coordinate. More...
 
void add (Vector3 v, boolean normalize)
 Adds a vector and then, if normalize is true normalize the vector. More...
 
void scale (float k)
 Scales the vector. More...
 
void preMultiply (float[] m)
 Premultiply the vector with a matrix. More...
 
void rotateX (float rotX)
 Rotate the vector around x-axis. More...
 
void rotateY (float angle)
 Rotate the vector around y-axis. More...
 
void rotateZ (float rotZ)
 Rotate the vector around z-axis. More...
 
void set (Point3 p1, Point3 p2)
 Creates a vector from point p1 to point p2. More...
 
void set (float x1, float y1, float z1, float x2, float y2, float z2)
 Creates the vector form point defined by (x1, y1, z1) to point defined by (x2, y2, z2) More...
 
void subtract (Vector3 u)
 
void copy (Vector3 out)
 
void set (float[] floatArray)
 
void set (Point3 p)
 Copies the coordinates of the given point. More...
 
void add (float x, float y, float z)
 Adds given coordinates to 3D point coordinates. More...
 
void add (Point3 p)
 Adds the point's coordinates. More...
 
void add (float x, float y)
 Adds given x and y to point x and way. More...
 
void add (Point2 p)
 Adds a point to this one, adding given point x and y coordinates to this x and y point. More...
 
float[] getCoordinatesArray ()
 
String toString ()
 
void subtract (Point3 p)
 Subtracts the point's coordinates. More...
 
float[] array ()
 Returns a three dimension array with the coordinates. More...
 
void inverseScale (Point3 scale)
 Scales the point, dividing the current coordinates with the given scale. More...
 
void scale (Point3 scale)
 Scales the point, multiplying the current coordinates with the given scale. More...
 
void rotatePointDegrees_x (double angle_degrees, Point3 origin)
 
void rotatePointDegrees_y (double angle_degrees, Point3 origin)
 
void rotatePointDegrees_z (double angle_degrees, Point3 origin)
 
void rotatePointRadians_z (double angle_radians, Point3 origin)
 
void rotatePointRadians_x (double angle_radians, Point3 origin)
 
void rotatePointRadians_y (double angle_radians, Point3 origin)
 
void copy (Point3 out)
 

Static Public Member Functions

static Vector3 normalVector (Point3 p1, Point3 p2, Point3 p3)
 Returns the normal vector to the plane formed by the 3 given points. More...
 
static Vector3 getVolatileVector (Point3 p1, Point3 p2)
 Returns a volatile vector pointing from p1 to p2. More...
 
static Vector3 getVolatileVector (float x1, float y1, float z1, float x2, float y2, float z2)
 
static Point3 getVolatilePoint (float x, float y, float z)
 

Public Attributes

float z
 z coordinate
 
float x
 x coordinate
 
float y
 y coordinate
 

Protected Attributes

float module
 Vector module.
 

Detailed Description

Represents a 3 dimensions vector.

Constructor & Destructor Documentation

com.beyondar.android.util.math.geom.Vector3.Vector3 ( float  x,
float  y,
float  z 
)

Constructs a vector from its 3 coordinates.

Parameters
xx coordinate
yy coordinate
zz coordinate
com.beyondar.android.util.math.geom.Vector3.Vector3 ( Point3  p1,
Point3  p2 
)

Constructs a vector that points from p1 to p2.

Parameters
p1Starting point for the vector
p2Finish point for the vector
com.beyondar.android.util.math.geom.Vector3.Vector3 ( Point3  v)

Constructs a vector from another vector.

It just clones its coordinates

Parameters
v

Member Function Documentation

void com.beyondar.android.util.math.geom.Point3.add ( float  x,
float  y,
float  z 
)
inherited

Adds given coordinates to 3D point coordinates.

Parameters
xx coordinate
yy coordinate
zz coordinate

Here is the call graph for this function:

Here is the caller graph for this function:

void com.beyondar.android.util.math.geom.Point2.add ( float  x,
float  y 
)
inherited

Adds given x and y to point x and way.

Parameters
x
y
void com.beyondar.android.util.math.geom.Point3.add ( Point3  p)
inherited

Adds the point's coordinates.

Parameters
pthe point

Here is the call graph for this function:

void com.beyondar.android.util.math.geom.Point2.add ( Point2  p)
inherited

Adds a point to this one, adding given point x and y coordinates to this x and y point.

Parameters
pthe point
void com.beyondar.android.util.math.geom.Vector3.add ( Vector3  v,
boolean  normalize 
)

Adds a vector and then, if normalize is true normalize the vector.

Parameters
vthe vector to be added
normalizeif the vector must be normalized after the addition

Here is the call graph for this function:

float com.beyondar.android.util.math.geom.Vector3.angle ( Vector3  v)

Returns the formed angle with the given vector.

Parameters
vthe vector
Returns
the tiniest angle between the two vectors at the plane formed by both

Here is the call graph for this function:

float [] com.beyondar.android.util.math.geom.Point3.array ( )
inherited

Returns a three dimension array with the coordinates.

Returns
Vector3 com.beyondar.android.util.math.geom.Vector3.crossProduct ( Vector3  v)

Returns the cross product with the given vector.

Parameters
vthe vector
Returns
the vector result from the cross product

Here is the call graph for this function:

float com.beyondar.android.util.math.geom.Vector3.dotProduct ( Vector3  v)

Returns the dot product with the given vector.

Parameters
vthe vector
Returns
the dot product

Here is the caller graph for this function:

int com.beyondar.android.util.math.geom.Vector3.getGreatestComponent ( )

Returns the index from the vector's greatest absolute coordinate.

Returns
the index from the vector's greatest absolute coordinate. 0 for the x, 1 for the y, 2 for the z
static Vector3 com.beyondar.android.util.math.geom.Vector3.getVolatileVector ( Point3  p1,
Point3  p2 
)
static

Returns a volatile vector pointing from p1 to p2.

We use a the volatile vector when we want to do calculations with vectors, but it's not necessary to keep the instance

void com.beyondar.android.util.math.geom.Point3.inverseScale ( Point3  scale)
inherited

Scales the point, dividing the current coordinates with the given scale.

Parameters
scalethe scale
float com.beyondar.android.util.math.geom.Vector3.module ( )

Returns vector module.

Returns
vector module

Here is the caller graph for this function:

float com.beyondar.android.util.math.geom.Vector3.module2 ( )

Returns module's square, avoiding do the square root.

Returns
static Vector3 com.beyondar.android.util.math.geom.Vector3.normalVector ( Point3  p1,
Point3  p2,
Point3  p3 
)
static

Returns the normal vector to the plane formed by the 3 given points.

Parameters
p1point 1
p2point 2
p3point 3
Returns
the normal vector to the plane formed by the 3 given points

Here is the call graph for this function:

void com.beyondar.android.util.math.geom.Vector3.preMultiply ( float[]  m)

Premultiply the vector with a matrix.

Parameters
mthe matrix

Here is the caller graph for this function:

void com.beyondar.android.util.math.geom.Vector3.rotateX ( float  rotX)

Rotate the vector around x-axis.

Parameters
rotXrotation in radians

Here is the call graph for this function:

void com.beyondar.android.util.math.geom.Vector3.rotateY ( float  angle)

Rotate the vector around y-axis.

Parameters
anglerotation in radians

Here is the call graph for this function:

void com.beyondar.android.util.math.geom.Vector3.rotateZ ( float  rotZ)

Rotate the vector around z-axis.

Parameters
rotZrotation in radians

Here is the call graph for this function:

void com.beyondar.android.util.math.geom.Point3.scale ( Point3  scale)
inherited

Scales the point, multiplying the current coordinates with the given scale.

Parameters
scalethe scale
void com.beyondar.android.util.math.geom.Vector3.scale ( float  k)

Scales the vector.

Parameters
kscale factor
void com.beyondar.android.util.math.geom.Point3.set ( Point3  p)
inherited

Copies the coordinates of the given point.

Parameters
pthe point
void com.beyondar.android.util.math.geom.Vector3.set ( Point3  p1,
Point3  p2 
)

Creates a vector from point p1 to point p2.

Parameters
p1start point
p2end point
void com.beyondar.android.util.math.geom.Vector3.set ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Creates the vector form point defined by (x1, y1, z1) to point defined by (x2, y2, z2)

Parameters
x1
y1
z1
x2
y2
z2
void com.beyondar.android.util.math.geom.Point3.subtract ( Point3  p)
inherited

Subtracts the point's coordinates.

Parameters
pthe point

Here is the call graph for this function:


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