public class GVector3d extends Object
The class suppors all the usual methods to perform conventional vector arithmetics such as vector and dot product.
Constructor and Description 

GVector3d()
Constructs and initializes a
GVector3d to
(0, 0, 0) 
GVector3d(double s)
Constructs and initializes a
GVector3d to the tuple
(s, s, s) . 
GVector3d(double[] v)
Constructs and initializes a
GVector3d from the first 3
elements of a given double array. 
GVector3d(double x,
double y,
double z)
Constructs and initializes a
GVector3d from a specified
(x, y, z) tuple. 
GVector3d(GVector3d v)
The copy constructor  constructs a new
GVector3d from a
given one by copying all elements. 
Modifier and Type  Method and Description 

GVector3d 
add(double r)
Adds a scalar
r to all coordinates of the vector, i.e.,
this = this + (r, r, r) . 
GVector3d 
add(GVector3d v)
Adds another vector
v to this one, i.e. 
static GVector3d 
add(GVector3d v,
GVector3d w)
Adds two vectors and return the result a new one.

GVector3d 
cross(GVector3d vec)
Sets this vector to the outer product of itself and a second vector
v , i.e. 
static GVector3d 
cross(GVector3d v,
GVector3d w)
Calculates the outer product of two given vectors
v and
w and returns the result as a new GVector3d . 
double 
dot(GVector3d v)
Calculates the dot product of this and another given vector.

double 
getX() 
double 
getY() 
double 
getZ() 
static GVector3d[] 
localTriad(double alpha,
double delta)
Computes the normal triad [p q r] at spherical coordinates
(alpha, delta) 
GVector3d 
scale(double s)
Scales the vector by a scalar
s , i.e. 
static GVector3d 
scale(double s,
GVector3d v)
Constructs new vector from scaling a given one.

GVector3d 
scaleAdd(double s,
GVector3d v)
Scales a given vector with a scalar and add the result to this one, i.e.

static GVector3d 
scaleAdd(GVector3d v1,
double s,
GVector3d v2)
Constructs new vector as sum of a given vector
v1 and a
scaled vector s*v2 . 
GVector3d 
set(double x,
double y,
double z)
Sets the elements of this vector to given 3tuple.

double 
x()
Identical to
getX() 
double 
y()
Identical to
getY() 
double 
z()
Identical to
getZ() 
public GVector3d()
GVector3d
to
(0, 0, 0)
public GVector3d(double s)
GVector3d
to the tuple
(s, s, s)
.s
 double value to be assigned to all componentspublic GVector3d(double[] v) throws IllegalArgumentException
GVector3d
from the first 3
elements of a given double array.v
 array of length >=3 to initialize this vector fromIllegalArgumentException
 if input array has less than three elementspublic GVector3d(double x, double y, double z)
GVector3d
from a specified
(x, y, z)
tuple.x
 x
coordinatey
 y
coordinatez
 z
coordinatepublic GVector3d(GVector3d v)
GVector3d
from a
given one by copying all elements.v
 Vector to set this object topublic GVector3d set(double x, double y, double z)
x
 new value of the X
coordinatey
 new value of the Y
coordinatez
 new value of the Z
coordinatepublic double getX()
X
coordinate value of this vectorpublic double getY()
Y
coordinate value of this vectorpublic double getZ()
Z
coordinate value of this vectorpublic double x()
getX()
public double y()
getY()
public double z()
getZ()
public static GVector3d[] localTriad(double alpha, double delta)
(alpha, delta)
alpha
 longitude [rad] (0<=alpha<2 Pi)delta
 latitude [rad] (Pi/2<=delta<=Pi/2)alpha
1: unit vector in the
direction of increasing delta
2: unit vector towards
the point (alpha, delta)
public GVector3d add(double r)
r
to all coordinates of the vector, i.e.,
this = this + (r, r, r)
.r
 scalar to add to all coordinatespublic GVector3d add(GVector3d v)
v
to this one, i.e.
this = this + v
.v
 vector to addpublic static GVector3d add(GVector3d v, GVector3d w)
v
 first operandw
 second operandv
and w
public GVector3d cross(GVector3d vec)
v
, i.e. this = this x v
vec
 vector with which to build the outer productpublic static GVector3d cross(GVector3d v, GVector3d w)
v
and
w
and returns the result as a new GVector3d
.v
 left operandw
 right operandv
and w
public double dot(GVector3d v)
v
 vector to build the dot product withv
public GVector3d scale(double s)
s
, i.e.
this = s*this
s
 scalar to scale the vector withpublic static GVector3d scale(double s, GVector3d v)
s
 scalar scaling factorv
 vector to scales
and v
as a new
GVector3d
public GVector3d scaleAdd(double s, GVector3d v)
this = this + s*v
.s
 scalar scaling factorv
 vector to scaleCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.