Class Plane
java.lang.Object
cnuphys.swim.util.Plane
A plane is defined by the equation ax + by + cz = d
- Author:
- heddle
-
Constructor Summary
ConstructorsConstructorDescriptionPlane(double a, double b, double c, double d) Create a plane of the form ax + by + cz = d -
Method Summary
Modifier 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
-
Plane
public 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
-
createPlane
Create a plane from a normal vector and a distance to the plane- Parameters:
normX- the x component of the normal vectornormY- the y component of the normal vectornormZ- the z component of the normal vectord- the d value of the plane ax + by + cz = d- Returns:
- the plane that contains p and its normal is norm
-
createPlane
Create 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
-
createPlane
Create 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
-
createTiltedPlane
Create a plane in the clas12 tilted system- Parameters:
d- the distance from the nominal target to the plane- Returns:
- The plane
-
contained
public boolean contained(double x, double y, double z, double tolerance) See if a point is contained (on) a plane- Parameters:
x- x coordinatey- y coordinatez- z coordinatetolerance- the maximum distance from the plane in the same units as the coordinates- Returns:
-
distanceToPlane
public 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
-
timeToPlane
public 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 coordinatey- y coordinatez- z coordinatevx- x component of velocity (arbitrary units)vy- y component of velocityvz- z component of velocity- Returns:
- the time to intersect the plane
-
dot
public 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:
-
infiniteLineIntersection
public 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.
-
directionSign
public 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 pointy- the y coordinate of the pointz- 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.
-
constantPhiPlane
Create a plane of constant azimuthal angle phi- Parameters:
phi- the azimuthal angle in degrees- Returns:
- the plane of constant phi
-
main
-