Package cnuphys.adaptiveSwim.geometry
Class Point
java.lang.Object
cnuphys.adaptiveSwim.geometry.Point
- Direct Known Subclasses:
Vector
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Point
difference
(Point a, Point b) Get the difference between two pointsstatic void
difference
(Point a, Point b, Point c) Get the in-place difference between two pointsdouble
distance
(double x, double y, double z) Compute the distance to another pointdouble
Compute the distance to another pointdouble
The dot product of this "vector" with another vectorstatic double
The dot product of two vectors or pointsvoid
set
(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
Copy constructor- Parameters:
p
- the point to copy
-
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
Get the difference between two points- Parameters:
a
- one pointb
- the other point- Returns:
- the difference between two points a - b
-
difference
Get the in-place difference between two points- Parameters:
a
- one pointb
- the other pointc
- upon return the difference between two points a - b
-
dot
The dot product of this "vector" with another vector- Parameters:
v
- the other vector or point- Returns:
- the dot product
-
dot
The dot product of two vectors or points- Parameters:
a
- one vector or pointb
- the other vector or point- Returns:
- the dot product
-
toString
Get a string representation of the Point -
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
-