Package healpix.essentials
Class Vec3
java.lang.Object
healpix.essentials.Vec3
Cartesian 3-vector.
Instead of using the javax.vecmath.Vector3d class, this separate class was
implemented for two reasons: first, to avoid the external dependency from
vecmath.jar, and also because the function Vector3d.angle(Vector3d v1) is
too inaccurate for usage in Healpix for very small angles.
- Author:
- Martin Reinecke
- Copyright:
- (C) 2011-2015 Max-Planck-Society
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionVector additionfinal double
Angle between two vectors.Vector cross product.final double
Computes the dot product of the this vector andv1
.boolean
void
flip()
Invert the signs of all componentsflipped()
int
hashCode()
final double
length()
Vector lengthfinal double
Squared vector lengthmul
(double n) Vector scaling.norm()
Return normalized vectorvoid
Normalize the vectorvoid
scale
(double n) Scale the vector by a given factorVector subtractiondouble[]
toArray()
void
toArray
(double[] arr) toString()
-
Field Details
-
x
public double x -
y
public double y -
z
public double z
-
-
Constructor Details
-
Method Details
-
length
public final double length()Vector length- Returns:
- the length of the vector.
-
lengthSquared
public final double lengthSquared()Squared vector length- Returns:
- the squared length of the vector.
-
normalize
public void normalize()Normalize the vector -
norm
Return normalized vector -
angle
Angle between two vectors.- Parameters:
v1
- another vector- Returns:
- the angle in radians between this vector and
v1
; constrained to the range [0,PI].
-
cross
Vector cross product.- Parameters:
v
- another vector- Returns:
- the vector cross product between this vector and
v
-
mul
Vector scaling.- Parameters:
n
- the scale number to be multiply to the coordinatesx,y,z
- Returns:
- the vector with coordinates multiplied by
n
-
flip
public void flip()Invert the signs of all components -
flipped
-
scale
public void scale(double n) Scale the vector by a given factor- Parameters:
n
- the scale factor
-
dot
Computes the dot product of the this vector andv1
.- Parameters:
v1
- another vector- Returns:
- dot product
-
add
Vector addition- Parameters:
v
- the vector to be added- Returns:
- addition result
-
sub
Vector subtraction- Parameters:
v
- the vector to be subtracted- Returns:
- subtraction result
-
toString
-
toArray
public double[] toArray() -
toArray
public void toArray(double[] arr) -
equals
-
hashCode
public int hashCode()
-