ProGAL.geom3d
Class Plane

java.lang.Object
  extended by ProGAL.geom3d.Plane
All Implemented Interfaces:
Shape

public class Plane
extends java.lang.Object
implements Shape

A plane in (x,y,z)-space represented by a point and a normal. Assuming that p is a point on the plane and n is the normal vector, the half-space {q|pq·n>0} is called the 'upper halfspace' wrt. the plane and vice versa for the 'lower halfspace'. If the unit normal vector is n = (nx,ny,nz) and the point on the plane is p = (px,py,pz), then the plane has equation ax + bx + cx = d where a = nx, b = ny, c = nz, and d = px*nx + py*ny + pz*nz


Constructor Summary
Plane(Point p, Point q, Point r)
          Constructs a plane through three points using the first point as defining point.
Plane(Point p, Vector n)
          Constructs a plane with the normal vector n containing point p.
Plane(Vector n)
          Constructs a plane with the normal vector n containing the point (0,0,0).
 
Method Summary
 int above(Point p)
          Returns 1/0/-1 if point p is above/on/below this plane.
 int below(Point p)
          Returns 1/0/-1 if point p is below/on/above this plane
 Point getCenter()
          Returns the defining point for this plane.
 double getDistance(Point p)
          Gets perpendicular distance of point to this plane
 Point[] getIntersection(Circle circle)
          Get intersection of a circle with the plane.
 Point[] getIntersection(Circle circle, Vector u)
           
 Point getIntersection(Line line)
          Get the intersection of a line with the plane.
 Point getIntersection(LineSegment sgm)
          Get the intersection of a segment with the plane.
 Line getIntersection(Plane pl)
          returns the intersection line with another plane
 Circle getIntersection(Sphere sphere)
          Get intersection of a sphere with the plane.
 java.lang.Double getIntersectionAngle(Circle circle, Point p, Vector dir, J3DScene scene)
           
 double getIntersectionParameter(Line line)
          Get the line-parameter of the intersection between a plane and a line.
 Vector getNormal()
          Return the normal defining this plane.
 Point getPoint()
          Get the point defining this plane.
 double getUnsignedDihedralAngle(Plane p)
          Get the unsigned angle between this plane and p.
static void main(java.lang.String[] args)
           
 Point projectPoint(Point p)
          Get the projection of p onto this plane.
 void setNormal(Vector n)
          Set the normal to n.
 void toScene(J3DScene scene, java.awt.Color clr, int size)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Plane

public Plane(Point p,
             Vector n)
Constructs a plane with the normal vector n containing point p.


Plane

public Plane(Vector n)
Constructs a plane with the normal vector n containing the point (0,0,0).


Plane

public Plane(Point p,
             Point q,
             Point r)
Constructs a plane through three points using the first point as defining point. The normal of the plane will be decided by the order of p, q and r such that if the right hand follows the rotation from p to q to r the thumb points in the normals direction. TODO: Test this An error is thrown if the points are collinear.

Method Detail

getPoint

public Point getPoint()
Get the point defining this plane.


getNormal

public Vector getNormal()
Return the normal defining this plane.


setNormal

public void setNormal(Vector n)
Set the normal to n.


projectPoint

public Point projectPoint(Point p)
Get the projection of p onto this plane.


above

public int above(Point p)
Returns 1/0/-1 if point p is above/on/below this plane.


below

public int below(Point p)
Returns 1/0/-1 if point p is below/on/above this plane


getDistance

public double getDistance(Point p)
Gets perpendicular distance of point to this plane


getUnsignedDihedralAngle

public double getUnsignedDihedralAngle(Plane p)
Get the unsigned angle between this plane and p.


getIntersection

public Point getIntersection(Line line)
Get the intersection of a line with the plane. Returns null if line is parallel to plane.


getIntersectionParameter

public double getIntersectionParameter(Line line)
Get the line-parameter of the intersection between a plane and a line. Returns infinity if line is parallel to plane. TODO: Consider moving to Line3d


getIntersection

public Point getIntersection(LineSegment sgm)
Get the intersection of a segment with the plane. Returns null if line is parallel to plane.


getIntersectionAngle

public java.lang.Double getIntersectionAngle(Circle circle,
                                             Point p,
                                             Vector dir,
                                             J3DScene scene)

getIntersection

public Point[] getIntersection(Circle circle)
Get intersection of a circle with the plane. Returns null if the plane does not intersect the circle or if the circle is in the plane. Returns the touch point if the plane is tangent to the circle. Otherwise returns 2 points


getIntersection

public Point[] getIntersection(Circle circle,
                               Vector u)

getIntersection

public Line getIntersection(Plane pl)
returns the intersection line with another plane


getIntersection

public Circle getIntersection(Sphere sphere)
Get intersection of a sphere with the plane. Returns null if the plane does not intersect the sphere. Returns a circle with radius 0 if the plane is tangent to the sphere. Otherwise returns circle


getCenter

public Point getCenter()
Returns the defining point for this plane. The center of a plane is not well-defined, so to implement the shape interface the defining point is simply used.

Specified by:
getCenter in interface Shape

toScene

public void toScene(J3DScene scene,
                    java.awt.Color clr,
                    int size)

main

public static void main(java.lang.String[] args)