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