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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFinds the sum of this Double3 with b.Finds the sum of this Double3 with b in place.doubleAngle of this Double3 with b.copy()Returns a new copy of this Double3.doubleFinds the Euclidean distance between two positions.doubleFinds the square of the Euclidean distance between two positions.doubleFinds the dot product between two vectors.Computethis * b + cand return the result in a new Double3.Computethis * b + cand return the result in a new Double3.double[]get()Returns a reference to the internal double array that stores this Double3.doubleget(int i) Returns the coordinate at position i.doublelength()Finds the length of this Double3.doublelength2()Finds the length of this Double3 squared.voidlog()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.doublex()Get the value x.Cross product of this Double3 with b.In-place Cross product of this Double3 with b.doubley()Get the value of y.doublez()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
-
fmaI
-
X
-
XI
-
add
-
addI
-
angle
Angle of this Double3 with b.- Parameters:
b- Vector b.- Returns:
- Returns the angle.
-
copy
-
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
-
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
-
sub
-
subI
-
toString
-
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.
-