Package cnuphys.adaptiveSwim.geometry
Class Plane
java.lang.Object
cnuphys.adaptiveSwim.geometry.Plane
A plane is defined by the equation (r - ro).norm = 0 Where r is an arbitrary
point on the plane, ro is a given point on the plane and norm is the normal
to the plane
- Author:
- heddle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Plane
constantPhiPlane
(double phi) Create a plane of constant azimuthal angle phidouble
distance
(double x, double y, double z) Distance from a point to the planedouble
Distance from a point to the planedouble
lineIntersection
(Line line, Point intersection) Compute the intersection of an infinite line with the planedouble
lineIntersection
(Line line, Point intersection, int lineType) static void
planeIntersection
(Plane plane) Obtain the line resulting from the intersection of this plane and another planefloat[]
planeQuadCoordinates
(float scale) Find some coordinates suitable for drawing the plane as a Quad in 3Ddouble
signedDistance
(double x, double y, double z) Signed distance from a point to the planedouble
Signed distance from a point to the planetoString()
-
Field Details
-
norm
-
p0
-
a
public final double a -
b
public final double b -
c
public final double c -
d
public final double d
-
-
Constructor Details
-
Plane
Create a plane from a normal vector and a point on the plane- Parameters:
norm
- the normal vectorp
- a point in the plane
-
Plane
public Plane(double[] norm, double[] point) Create a plane from the normal vector in an array of doubles and a point in the plane in an array, both (x, y, z)- Parameters:
norm
- the normalpoint
- the point in the plane
-
-
Method Details
-
distance
Distance from a point to the plane- Parameters:
p
- the point in question- Returns:
- the distance to the plane
-
distance
public double distance(double x, double y, double z) Distance from a point to the plane- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinate- Returns:
- the distance to the plane
-
signedDistance
Signed distance from a point to the plane- Parameters:
p
- the point in question- Returns:
- the signed distance (indicates which side you are on where norm defines positive side)
-
signedDistance
public double signedDistance(double x, double y, double z) Signed distance from a point to the plane- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinate- Returns:
- the signed distance (indicates which side you are on where norm defines positive side)
-
lineIntersection
Compute the intersection of an infinite line with the plane- Parameters:
line
- the lineintersection
- will hold the point of intersection- Returns:
- the t parameter. If NaN it means the line is parallel to the plane. If t [0,1] then the segment intersects the line. If t outside [0, 1] the infinite line intersects the plane, but not the segment
-
lineIntersection
- Parameters:
line
- the lineintersection
- will hold the point of intersectionlineType
- one of the Constants INFINITE or SEGMENT- Returns:
- the t parameter. If NaN, then either the line is parallel to the plane or we are treating as a line segment and the segment does not "reach" the plane
-
constantPhiPlane
Create a plane of constant azimuthal angle phi- Parameters:
phi
- the azimuthal angle in degrees- Returns:
- the plane of constant phi
-
toString
-
planeIntersection
Obtain the line resulting from the intersection of this plane and another plane- Parameters:
plane
- the other plane- Returns:
- line formed by the intersection
-
planeQuadCoordinates
public float[] planeQuadCoordinates(float scale) Find some coordinates suitable for drawing the plane as a Quad in 3D- Parameters:
scale
- an arbitrary big number, a couple times bigger than the drawing extent- Returns:
- the jogl coordinates for drawing a Quad
-
main
-