Package cnuphys.swim.util
Class Plane
java.lang.Object
cnuphys.swim.util.Plane
A plane is defined by the equation ax + by + cz = d
- Author:
- heddle
- 
Constructor SummaryConstructorsConstructorDescriptionPlane(double a, double b, double c, double d) Create a plane of the form ax + by + cz = d
- 
Method SummaryModifier and TypeMethodDescriptionstatic PlaneconstantPhiPlane(double phi) Create a plane of constant azimuthal angle phibooleancontained(double x, double y, double z, double tolerance) See if a point is contained (on) a planestatic PlanecreatePlane(double[] norm, double d) Create a plane from a normal vector and a distance to the planestatic PlanecreatePlane(double[] norm, double[] p) Create a plane from a normal vector and a point on the planestatic PlanecreatePlane(double normX, double normY, double normZ, double d) Create a plane from a normal vector and a distance to the planestatic PlanecreateTiltedPlane(double d) Create a plane in the clas12 tilted systemintdirectionSign(double x, double y, double z) Get the sign of a point relative to a plane.doubledistanceToPlane(double x, double y, double z) Get the perpendicular distance for a point to the planedoubledot(double x, double y, double z) Get the common construct a*x + b*y + c*z -d for the plane defined by ax + by + cz = ddouble[]infiniteLineIntersection(double[] p1, double[] p2) Compute the intersection of an infinite line with the planestatic voiddoubletimeToPlane(double x, double y, double z, double vx, double vy, double vz) Given a current position and velocity, compute the time to intersect the plane
- 
Constructor Details- 
Planepublic Plane(double a, double b, double c, double d) Create a plane of the form ax + by + cz = d- Parameters:
- a-
- b-
- c-
- d-
 
 
- 
- 
Method Details- 
createPlaneCreate a plane from a normal vector and a distance to the plane- Parameters:
- normX- the x component of the normal vector
- normY- the y component of the normal vector
- normZ- the z component of the normal vector
- d- the d value of the plane ax + by + cz = d
- Returns:
- the plane that contains p and its normal is norm
 
- 
createPlaneCreate a plane from a normal vector and a distance to the plane- Parameters:
- norm- the outward normal vector where the components (0, 1, 2) map to (x, y, z)
- d- the distance from the origin to the plane
- Returns:
- the plane that contains p and its normal is norm
 
- 
createPlaneCreate a plane from a normal vector and a point on the plane- Parameters:
- norm- the normal vector where the components (0, 1, 2) map to (x, y, z)
- p- a point in the plane where the components (0, 1, 2) map to (x, y, z)
- Returns:
- the plane that contains p and its normal is norm
 
- 
createTiltedPlaneCreate a plane in the clas12 tilted system- Parameters:
- d- the distance from the nominal target to the plane
- Returns:
- The plane
 
- 
containedpublic boolean contained(double x, double y, double z, double tolerance) See if a point is contained (on) a plane- Parameters:
- x- x coordinate
- y- y coordinate
- z- z coordinate
- tolerance- the maximum distance from the plane in the same units as the coordinates
- Returns:
 
- 
distanceToPlanepublic double distanceToPlane(double x, double y, double z) Get the perpendicular distance for a point to the plane- Parameters:
- x- the x coordinate of the point.
- y- the y coordinate of the point.
- z- the z coordinate of the point.
- Returns:
- the perpendicular distance
 
- 
timeToPlanepublic double timeToPlane(double x, double y, double z, double vx, double vy, double vz) Given a current position and velocity, compute the time to intersect the plane- Parameters:
- x- x coordinate
- y- y coordinate
- z- z coordinate
- vx- x component of velocity (arbitrary units)
- vy- y component of velocity
- vz- z component of velocity
- Returns:
- the time to intersect the plane
 
- 
dotpublic double dot(double x, double y, double z) Get the common construct a*x + b*y + c*z -d for the plane defined by ax + by + cz = d- Parameters:
- x-
- y-
- z-
- Returns:
 
- 
infiniteLineIntersectionpublic double[] infiniteLineIntersection(double[] p1, double[] p2) Compute the intersection of an infinite line with the plane- Parameters:
- p1- a point on the line where the components (0, 1, 2) map to (x, y, z)
- p2- a point on the line where the components (0, 1, 2) map to (x, y, z)
- Returns:
- the intersection p where the components (0, 1, 2) map to (x, y, z). If there is no intersection, returns null.
 
- 
directionSignpublic int directionSign(double x, double y, double z) Get the sign of a point relative to a plane. If it is -1 it is on one side of the plane (call it left). If it is +1 it is on the other. Thus you can determine when you cross the plane: when the sign changes.- Parameters:
- x- the x coordinate of the point
- y- the y coordinate of the point
- z- the z coordinate of the point
- Returns:
- 0 if the point is on (or almost on modulo TINY) the plane, -1 if it is on one side, + 1 if it is on the other.
 
- 
constantPhiPlaneCreate a plane of constant azimuthal angle phi- Parameters:
- phi- the azimuthal angle in degrees
- Returns:
- the plane of constant phi
 
- 
main
 
-