|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.PSVector
public class PSVector
PSVector Class
The PSVector object specifies a location within xyz coordinate space with floating point precision.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Field Summary | |
---|---|
float |
x
|
float |
y
|
float |
z
|
Constructor Summary | |
---|---|
PSVector()
Create a new object instance with zero values |
|
PSVector(float[] arr)
Create a new object instance using values from the specified array |
|
PSVector(float x,
float y)
Create a new object instance with the specified values |
|
PSVector(float x,
float y,
float z)
Create a new object instance with the specified values |
|
PSVector(PSVector v)
Create a new object instance using values from the specified vector |
Method Summary | |
---|---|
void |
add(float x,
float y)
Add the specified values to this vector |
void |
add(float x,
float y,
float z)
Add the specified values to this vector |
void |
add(PSVector v)
Add the specified vector to this vector |
static PSVector |
add(PSVector v1,
PSVector v2)
Add the two specified vectors and return the result |
float |
angleBetween(PSVector v)
Return the angle between this vector and that specified |
PSVector |
copy()
Return a copy of this vector |
PSVector |
cross(PSVector v)
Return the cross product of this vector and that specified |
float |
distance(PSVector v)
Return the distance between this vector and that specified |
float |
dot(PSVector v)
Return the dot product of this vector and that specified |
PSVector |
getPerpendicular()
Return a normalised vector perpendicular to this one |
void |
limit(float m)
Limit this vector to the specified magnitude |
static PSVector |
limit(PSVector v,
float m)
Limit a vector to the specified magnitude and return the result as a new vector |
float |
magnitude()
Return the magnitude of this vector |
void |
normalise()
Normalise this vector |
static PSVector |
normalise(PSVector v)
Normalise a vector and return the result as a new vector |
void |
normaliseTo(float m)
Normalise this vector to the specified magnitude |
static PSVector |
normaliseTo(PSVector v,
float m)
Normalise a vector to the specified magnitude and return the result as a new vector |
float |
pitch()
Return the pitch of the vector relative to the origin in radians |
void |
rotateAboutOrigin(float a,
PSVector av)
Rotate this vector about the origin on the specified axis |
static PSVector |
rotateAboutOrigin(PSVector v,
float a,
PSVector av)
Rotate a vector the origin on the specified axis and return the result as a new vector |
void |
scale(float s)
Multiply this vector by the specified scalar |
void |
scale(PSVector v)
Multiply the component values of this vector by those within the specified vector |
static PSVector |
scale(PSVector v,
float s)
Multiply a vector by the specified scalar and return the result as a new vector |
static PSVector |
scale(PSVector v1,
PSVector v2)
Multiply two vectors and return the result as a new vector |
void |
set(float[] arr)
Set the component values using values from the specified array |
void |
set(float x,
float y)
Set the x and y values |
void |
set(float x,
float y,
float z)
Set the component values |
void |
set(PSVector v)
Set the component values using values from the specified vector |
void |
sub(float x,
float y)
Subtract the specified values from this vector |
void |
sub(float x,
float y,
float z)
Subtract the specified values from this vector |
void |
sub(PSVector v)
Subtract the specified vector from this vector |
static PSVector |
sub(PSVector v1,
PSVector v2)
Subtract one vector from another and return the result |
float[] |
toArray()
Return the component values of this vector as an array |
java.lang.String |
toString()
Return the vector component values as a string |
float |
yaw()
Return the yaw of the vector relative to the origin in radians |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
Constructor Detail |
---|
public PSVector()
public PSVector(float x, float y)
x
- xy
- ypublic PSVector(float x, float y, float z)
x
- xy
- yz
- zpublic PSVector(float[] arr)
arr
- arraypublic PSVector(PSVector v)
v
- vectorMethod Detail |
---|
public final void set(float x, float y)
x
- xy
- ypublic final void set(float x, float y, float z)
x
- xy
- yz
- zpublic final void set(float[] arr)
arr
- arraypublic final void set(PSVector v)
v
- public PSVector copy()
public final float[] toArray()
public final void add(float x, float y)
x
- xy
- ypublic final void add(float x, float y, float z)
x
- xy
- yz
- zpublic final void add(PSVector v)
v
- vectorpublic static final PSVector add(PSVector v1, PSVector v2)
v1
- vector 1v2
- vector 2
public final void sub(float x, float y)
x
- xy
- ypublic final void sub(float x, float y, float z)
x
- xy
- yz
- zpublic final void sub(PSVector v)
v
- vectorpublic static PSVector sub(PSVector v1, PSVector v2)
v1
- vector 1v2
- vector 2
public final void scale(float s)
s
- scalarpublic final void scale(PSVector v)
v
- vectorpublic static PSVector scale(PSVector v, float s)
v
- vectors
- scalar
public static PSVector scale(PSVector v1, PSVector v2)
v1
- v2
-
public final void limit(float m)
m
- magnitudepublic static PSVector limit(PSVector v, float m)
v
- vectorm
- magnitude
public final void normalise()
public static PSVector normalise(PSVector v)
v
- vector
public final void normaliseTo(float m)
m
- magnitudepublic static PSVector normaliseTo(PSVector v, float m)
v
- vectorm
- magnitude
public final float magnitude()
public final float distance(PSVector v)
v
- vector
public final float dot(PSVector v)
v
- vector
public final PSVector cross(PSVector v)
v
- vector
public final PSVector getPerpendicular()
public final float angleBetween(PSVector v)
v
- vector
public final void rotateAboutOrigin(float a, PSVector av)
a
- angleav
- axis vectorpublic static PSVector rotateAboutOrigin(PSVector v, float a, PSVector av)
v
- vector to be rotateda
- angleav
- axis vector
public final float pitch()
public final float yaw()
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 |