Represents a 3 dimensions vector. More...
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. | |
Represents a 3 dimensions vector.
com.beyondar.android.util.math.geom.Vector3.Vector3 | ( | float | x, |
float | y, | ||
float | z | ||
) |
Constructs a vector from its 3 coordinates.
x | x coordinate |
y | y coordinate |
z | z coordinate |
Constructs a vector that points from p1 to p2.
p1 | Starting point for the vector |
p2 | Finish 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
v |
|
inherited |
Adds given coordinates to 3D point coordinates.
x | x coordinate |
y | y coordinate |
z | z coordinate |
|
inherited |
Adds given x and y to point x and way.
x | |
y |
|
inherited |
Adds the point's coordinates.
p | the point |
|
inherited |
Adds a point to this one, adding given point x and y coordinates to this x and y point.
p | the 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.
v | the vector to be added |
normalize | if the vector must be normalized after the addition |
float com.beyondar.android.util.math.geom.Vector3.angle | ( | Vector3 | v | ) |
Returns the formed angle with the given vector.
v | the vector |
|
inherited |
Returns a three dimension array with the coordinates.
Returns the cross product with the given vector.
v | the vector |
float com.beyondar.android.util.math.geom.Vector3.dotProduct | ( | Vector3 | v | ) |
Returns the dot product with the given vector.
v | the vector |
int com.beyondar.android.util.math.geom.Vector3.getGreatestComponent | ( | ) |
Returns the index from the vector's greatest absolute coordinate.
|
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
|
inherited |
Scales the point, dividing the current coordinates with the given scale.
scale | the scale |
float com.beyondar.android.util.math.geom.Vector3.module | ( | ) |
Returns vector module.
float com.beyondar.android.util.math.geom.Vector3.module2 | ( | ) |
Returns module's square, avoiding do the square root.
|
static |
Returns the normal vector to the plane formed by the 3 given points.
p1 | point 1 |
p2 | point 2 |
p3 | point 3 |
void com.beyondar.android.util.math.geom.Vector3.preMultiply | ( | float[] | m | ) |
Premultiply the vector with a matrix.
m | the matrix |
void com.beyondar.android.util.math.geom.Vector3.rotateX | ( | float | rotX | ) |
Rotate the vector around x-axis.
rotX | rotation in radians |
void com.beyondar.android.util.math.geom.Vector3.rotateY | ( | float | angle | ) |
Rotate the vector around y-axis.
angle | rotation in radians |
void com.beyondar.android.util.math.geom.Vector3.rotateZ | ( | float | rotZ | ) |
Rotate the vector around z-axis.
rotZ | rotation in radians |
|
inherited |
Scales the point, multiplying the current coordinates with the given scale.
scale | the scale |
void com.beyondar.android.util.math.geom.Vector3.scale | ( | float | k | ) |
Scales the vector.
k | scale factor |
|
inherited |
Copies the coordinates of the given point.
p | the point |
Creates a vector from point p1 to point p2.
p1 | start point |
p2 | end 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)
x1 | |
y1 | |
z1 | |
x2 | |
y2 | |
z2 |
|
inherited |
Subtracts the point's coordinates.
p | the point |