Class Vector
java.lang.Object
cnuphys.adaptiveSwim.geometry.Point
cnuphys.adaptiveSwim.geometry.Vector
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleangleBetween(Vector a, Vector b) Compute the angle between two vectors in radiansstatic doubleangleBetweenDeg(Vector a, Vector b) Compute the angle between two vectors in degreesstatic VectorThe cross product of two vectorsstatic voidThe in-place cross product of two vectorsstatic Vectordifference(Vector a, Vector b) Get the difference between two vectorsstatic voiddifference(Vector a, Vector b, Vector c) Get the in-place difference between two vectorsdoublelength()The length of the vectordoubleThe square of the length of the vectorstatic Vectorproject vector a in the direction of vector bvoidscale(double scaleFactor) Scale a vectorvoidset(double x, double y, double z) Set the components of the vectorGet a unit vector in the same direction as thisMethods inherited from class Point
difference, difference, distance, distance, dot, dot, toString
-
Constructor Details
-
Vector
public Vector()Create a new vetor with a zero components -
Vector
-
Vector
public Vector(double x, double y, double z) Create a vector- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
-
Method Details
-
lengthSquared
public double lengthSquared()The square of the length of the vector- Returns:
- the square of the length of the vector
-
length
public double length()The length of the vector- Returns:
- the length of the vector
-
set
-
cross
-
cross
-
scale
public void scale(double scaleFactor) Scale a vector- Parameters:
scaleFactor- the scale factor
-
angleBetween
-
angleBetweenDeg
-
unitVector
-
project
-
difference
-
difference
-