public class Vec3 extends Object
Constructor and Description |
---|
Vec3()
Default constructor.
|
Vec3(double[] arr) |
Vec3(double x1,
double y1,
double z1)
Creation from individual components
|
Vec3(Pointing ptg)
Conversion from
Pointing |
Vec3(Vec3 v) |
Vec3(Zphi zphi)
Conversion from
Zphi |
Modifier and Type | Method and Description |
---|---|
Vec3 |
add(Vec3 v)
Vector addition
|
double |
angle(Vec3 v1)
Angle between two vectors.
|
Vec3 |
cross(Vec3 v)
Vector cross product.
|
double |
dot(Vec3 v1)
Computes the dot product of the this vector and
v1 . |
boolean |
equals(Object o) |
void |
flip()
Invert the signs of all components
|
Vec3 |
flipped() |
int |
hashCode() |
double |
length()
Vector length
|
double |
lengthSquared()
Squared vector length
|
Vec3 |
mul(double n)
Vector scaling.
|
Vec3 |
norm()
Return normalized vector
|
void |
normalize()
Normalize the vector
|
void |
scale(double n)
Scale the vector by a given factor
|
Vec3 |
sub(Vec3 v)
Vector subtraction
|
double[] |
toArray() |
void |
toArray(double[] arr) |
String |
toString() |
public Vec3()
public Vec3(Vec3 v)
public Vec3(double x1, double y1, double z1)
public Vec3(double[] arr)
public final double length()
public final double lengthSquared()
public void normalize()
public Vec3 norm()
public final double angle(Vec3 v1)
v1
- another vectorv1
;
constrained to the range [0,PI].public Vec3 cross(Vec3 v)
v
- another vectorv
public Vec3 mul(double n)
n
- the scale number to be multiply to the coordinates x,y,z
n
public void flip()
public Vec3 flipped()
public void scale(double n)
n
- the scale factorpublic final double dot(Vec3 v1)
v1
.v1
- another vectorpublic Vec3 add(Vec3 v)
v
- the vector to be addedpublic Vec3 sub(Vec3 v)
v
- the vector to be subtractedpublic double[] toArray()
public void toArray(double[] arr)