|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Vector3D
public class Vector3D
The Vector3D class contains methods to simplify common 3D vector functions,
such as cross and dot product, normalize, etc.
SoundSystem License:
You are free to use this library for any purpose, commercial or otherwise.
You may modify this library or source code, and distribute it any way you
like, provided the following conditions are met:
1) You may not falsely claim to be the author of this library or any
unmodified portion of it.
2) You may not copyright this library or a modified version of it and then
sue me for copyright infringement.
3) If you modify the source code, you must clearly document the changes
made before redistributing the modified source code, so other users know
it is not the original code.
4) You are not required to give me credit for this library in any derived
work, but if you do, you must also mention my website:
http://www.paulscode.com
5) I the author will not be responsible for any damages (physical,
financial, or otherwise) caused by the use if this library or any part
of it.
6) I the author do not guarantee, warrant, or make any representations,
either expressed or implied, regarding the use of this library or any
part of it.
Author: Paul Lamb
http://www.paulscode.com
| Field Summary | |
|---|---|
float |
x
The vector's X coordinate. |
float |
y
The vector's Y coordinate. |
float |
z
The vector's Z coordinate. |
| Constructor Summary | |
|---|---|
Vector3D()
Constructor: Places the vector at the origin. |
|
Vector3D(float nx,
float ny,
float nz)
Constructor: Places the vector at the specified 3D coordinates. |
|
| Method Summary | |
|---|---|
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. |
java.lang.String |
toString()
Returns a string depicting this vector. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public float x
public float y
public float z
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public Vector3D clone()
clone in class java.lang.Object
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()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||