public class Vector3D extends Object
| Modifier and Type | Field and Description |
|---|---|
float |
x
The vector's X coordinate.
|
float |
y
The vector's Y coordinate.
|
float |
z
The vector's Z coordinate.
|
| Constructor and Description |
|---|
Vector3D()
Constructor: Places the vector at the origin.
|
Vector3D(float nx,
float ny,
float nz)
Constructor: Places the vector at the specified 3D coordinates.
|
| Modifier and Type | Method and Description |
|---|---|
Vector3D |
add(Vector3D B)
Returns the vector represented by: (this) + B.
|
Vector3D |
add(Vector3D A,
Vector3D B)
Returns the vector represented by: A + B.
|
Vector3D |
clone()
Returns a new instance containing the same information as this one.
|
Vector3D |
cross(Vector3D B)
Returns a vector containing the cross-product: (this) cross B.
|
Vector3D |
cross(Vector3D A,
Vector3D B)
Returns a vector containing the cross-product: A cross B.
|
float |
dot(Vector3D B)
Returns the dot-product result of: (this) dot B.
|
float |
dot(Vector3D A,
Vector3D B)
Returns the dot-product result of: A dot B.
|
float |
length()
Returns the length of this vector.
|
void |
normalize()
Changes the length of this vector to 1.0.
|
Vector3D |
subtract(Vector3D B)
Returns the vector represented by: (this) - B.
|
Vector3D |
subtract(Vector3D A,
Vector3D B)
Returns the vector represented by: A - B.
|
String |
toString()
Returns a string depicting this vector.
|
public float x
public float y
public float z
public Vector3D()
public Vector3D(float nx,
float ny,
float nz)
nx - X coordinate for the new vector.ny - Y coordinate for the new vector.nz - Z coordinate for the new vector.public Vector3D clone()
public Vector3D cross(Vector3D A, Vector3D B)
A - First vector in the cross product.B - Second vector in the cross product.public Vector3D cross(Vector3D B)
B - Second vector in the cross product.public float dot(Vector3D A, Vector3D B)
A - First vector in the dot product.B - Second vector in the dot product.public float dot(Vector3D B)
B - Second vector in the dot product.public Vector3D add(Vector3D A, Vector3D B)
A - First vector.B - Vector to add to A.public Vector3D add(Vector3D B)
B - Vector to add to this one.public Vector3D subtract(Vector3D A, Vector3D B)
A - First vector.B - Vector to subtract from A.public Vector3D subtract(Vector3D B)
B - Vector to subtract from this one.public float length()
public void normalize()
Copyright © 2017. All rights reserved.