Class Plane

java.lang.Object
cnuphys.adaptiveSwim.geometry.Plane

public class Plane extends Object
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
    Modifier and Type
    Field
    Description
    final double
     
    final double
     
    final double
     
    final double
     
    final Vector
     
    final Point
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
    Plane(Vector anorm, Point p)
    Create a plane from a normal vector and a point on the plane
  • Method Summary

    Modifier and Type
    Method
    Description
    static Plane
    constantPhiPlane(double phi)
    Create a plane of constant azimuthal angle phi
    double
    distance(double x, double y, double z)
    Distance from a point to the plane
    double
    Distance from a point to the plane
    double
    lineIntersection(Line line, Point intersection)
    Compute the intersection of an infinite line with the plane
    double
    lineIntersection(Line line, Point intersection, int lineType)
     
    static void
    main(String[] arg)
     
    Obtain the line resulting from the intersection of this plane and another plane
    float[]
    planeQuadCoordinates(float scale)
    Find some coordinates suitable for drawing the plane as a Quad in 3D
    double
    signedDistance(double x, double y, double z)
    Signed distance from a point to the plane
    double
    Signed distance from a point to the plane
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • norm

      public final Vector norm
    • p0

      public final Point p0
    • a

      public final double a
    • b

      public final double b
    • c

      public final double c
    • d

      public final double d
  • Constructor Details

    • Plane

      public Plane(Vector anorm, Point p)
      Create a plane from a normal vector and a point on the plane
      Parameters:
      norm - the normal vector
      p - 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 normal
      point - the point in the plane
  • Method Details

    • distance

      public double distance(Point p)
      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 coordinate
      y - the y coordinate
      z - the z coordinate
      Returns:
      the distance to the plane
    • signedDistance

      public double signedDistance(Point p)
      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 coordinate
      y - the y coordinate
      z - the z coordinate
      Returns:
      the signed distance (indicates which side you are on where norm defines positive side)
    • lineIntersection

      public double lineIntersection(Line line, Point intersection)
      Compute the intersection of an infinite line with the plane
      Parameters:
      line - the line
      intersection - 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

      public double lineIntersection(Line line, Point intersection, int lineType)
      Parameters:
      line - the line
      intersection - will hold the point of intersection
      lineType - 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

      public static Plane constantPhiPlane(double phi)
      Create a plane of constant azimuthal angle phi
      Parameters:
      phi - the azimuthal angle in degrees
      Returns:
      the plane of constant phi
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • planeIntersection

      public Line planeIntersection(Plane plane)
      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

      public static void main(String[] arg)