Package ffx.numerics.math
Class Float3
java.lang.Object
ffx.numerics.math.Float3
Convenience class for working with 3D float vectors.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFinds the sum of this Float3 with b.Finds the sum of this Float3 with b in place.float
Angle of this Float3 with b.copy()
Returns a new copy of this Float3.float
Finds the distance between two vectors.float
Finds the squared distance between two vectorsfloat
Finds the dot product between two vectors.Compute a * b + c and return the result in a new Float3.Compute a * b + c and return the result in a new Float3.float[]
get()
Returns a reference to the internal float array that stores this Float3.float
get
(int i) Returns the coordinate at position i.float
length()
Finds the length of this Float3.float
length2()
Finds the length of this Float3 squared.void
log()
Log this Float3.Normalize this Float3.Normalize this Float3 in place.scale
(float d) Scales a Float3.scaleI
(float d) Scales a Float3 in place.set
(float[] b) Set the value of this Float3.set
(float x, float y, float z) Set the value of this Float3.Set the value of this Float3.sqrt()
Square roots values in Float3.sqrtI()
Square roots values in Float3 in place.square()
Squares values in Float3.squareI()
Squares values in Float3 in place.Finds the difference between two vectors.Finds the difference between two vectors.toString()
Describe this Float3 in a String.float
x()
Get the value x.Cross product of this Float3 with b.In-place Cross product of this Float3 with b.float
y()
Get the value of y.float
z()
Get the value of z.
-
Constructor Details
-
Float3
public Float3()Construct a Float3 at (0.0, 0.0, 0.0). -
Float3
public Float3(float x, float y, float z) Construct a Float3 at (x, y, z).- Parameters:
x
- X value.y
- Y value.z
- Z value.
-
Float3
public Float3(float[] a) Construct a Float3 at a.- Parameters:
a
- Float3 to initialize from (the data is copied).
-
-
Method Details
-
fma
Compute a * b + c and return the result in a new Float3.- Parameters:
b
- Scalar.c
- Float3.- Returns:
- Returns the FMA of a * b + c in a new Float3.
-
fmaI
Compute a * b + c and return the result in a new Float3.- Parameters:
b
- Scalar.c
- Float3.- Returns:
- Returns the FMA of a * b + c in a new Float3.
-
X
Cross product of this Float3 with b.- Parameters:
b
- Vector b.- Returns:
- Returns the cross product in a new Float3.
-
XI
In-place Cross product of this Float3 with b.- Parameters:
b
- Vector b.- Returns:
- Returns the cross product in this Float3.
-
add
Finds the sum of this Float3 with b.- Parameters:
b
- Second Float3.- Returns:
- Returns the sum in a new Float3.
-
addI
Finds the sum of this Float3 with b in place.- Parameters:
b
- Second Float3.- Returns:
- Returns the sum in this Float3.
-
angle
Angle of this Float3 with b.- Parameters:
b
- Vector b.- Returns:
- Returns the angle.
-
copy
Returns a new copy of this Float3.- Returns:
- Returns a copy of this Float3.
-
dist
Finds the distance between two vectors.- Parameters:
b
- Second vector.- Returns:
- Returns the distance between this Float3 and b.
-
dist2
Finds the squared distance between two vectors- Parameters:
b
- Second vector.- Returns:
- Returns the squared distance between this Float3 and b.
-
dot
Finds the dot product between two vectors.- Parameters:
b
- Second vector.- Returns:
- Returns the dot product of this Float3 and b.
-
get
public float[] get()Returns a reference to the internal float array that stores this Float3.- Returns:
- A reference to the internal float array.
-
get
public float get(int i) Returns the coordinate at position i.- Parameters:
i
- The coordinate index.- Returns:
- The coordinate.
-
length
public float length()Finds the length of this Float3.- Returns:
- Length of vector this Float3.
-
length2
public float length2()Finds the length of this Float3 squared.- Returns:
- Length of vector this Float3 squared.
-
log
public void log()Log this Float3. -
normalize
Normalize this Float3.- Returns:
- Returns the normalized vector in a new Float3.
-
normalizeI
Normalize this Float3 in place.- Returns:
- Returns a reference to this Float3 normalized.
-
scale
Scales a Float3.- Parameters:
d
- A scalar value.- Returns:
- Returns a new scaled Float3.
-
scaleI
Scales a Float3 in place.- Parameters:
d
- A scalar value.- Returns:
- Returns a reference to this Float3 scaled.
-
square
Squares values in Float3.- Returns:
- Returns a reference to this Float3 squared.
-
squareI
Squares values in Float3 in place.- Returns:
- Returns a reference to this Float3 squared.
-
sqrt
Square roots values in Float3.- Returns:
- Returns a reference to this Float3 square rooted.
-
sqrtI
Square roots values in Float3 in place.- Returns:
- Returns a reference to this Float3 square rooted.
-
set
Set the value of this Float3.- Parameters:
x
- X-value.y
- Y-value.z
- Z-value.- Returns:
- A reference to this Float3.
-
set
Set the value of this Float3.- Parameters:
b
- Double array that is copied.- Returns:
- A reference to this Float3.
-
set
Set the value of this Float3.- Parameters:
b
- Float3 that is copied.- Returns:
- A reference to this Float3.
-
sub
Finds the difference between two vectors.- Parameters:
b
- Second vector- Returns:
- Returns the difference in a new Float3.
-
subI
Finds the difference between two vectors.- Parameters:
b
- Second vector- Returns:
- Returns the difference in this Float3.
-
toString
Describe this Float3 in a String. -
x
public float x()Get the value x.- Returns:
- Returns x.
-
y
public float y()Get the value of y.- Returns:
- Returns y.
-
z
public float z()Get the value of z.- Returns:
- Returns z.
-