Class Point
java.lang.Object
cnuphys.adaptiveSwim.geometry.Point
- Direct Known Subclasses:
Vector
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Pointdifference(Point a, Point b) Get the difference between two pointsstatic voiddifference(Point a, Point b, Point c) Get the in-place difference between two pointsdoubledistance(double x, double y, double z) Compute the distance to another pointdoubleCompute the distance to another pointdoubleThe dot product of this "vector" with another vectorstatic doubleThe dot product of two vectors or pointsvoidset(double x, double y, double z) Set the components of the vectortoString()Get a string representation of the Point
-
Field Details
-
x
public double xx component -
y
public double yy component -
z
public double zz component
-
-
Constructor Details
-
Point
public Point()Create a point at the origin -
Point
-
Point
public Point(double x, double y, double z) Create a point- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
Point
public Point(double[] p) Create a point- Parameters:
p- the point as an xyz array
-
-
Method Details
-
set
public void set(double x, double y, double z) Set the components of the vector- Parameters:
x- the x componenty- the y componentz- the z component
-
difference
-
difference
-
dot
The dot product of this "vector" with another vector- Parameters:
v- the other vector or point- Returns:
- the dot product
-
dot
-
toString
-
distance
public double distance(double x, double y, double z) Compute the distance to another point- Parameters:
x- the x coordinate of the other pointy- the y coordinate of the other pointz- the z coordinate of the other point- Returns:
- the distance between the points
-
distance
Compute the distance to another point- Parameters:
p- the other point- Returns:
- the distance between the points
-