org.geotools.math
Class Plane

java.lang.Object
  extended byorg.geotools.math.Plane
All Implemented Interfaces:
java.lang.Cloneable, org.opengis.util.Cloneable, java.io.Serializable

public class Plane
extends java.lang.Object
implements org.opengis.util.Cloneable, java.io.Serializable

Equation of a plane in a three-dimensional space (x,y,z). The plane equation is expressed by c, cx and cy coefficients as below:

z(x,y) = c + cx*x + cy*y
Those coefficients can be set directly, or computed by a linear regression of this plane through a set of three-dimensional points.

Since:
2.0
Version:
$Id: Plane.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux, Howard Freeland
See Also:
Serialized Form

Field Summary
 double c
          The c coefficient for this plane.
 double cx
          The cx coefficient for this plane.
 double cy
          The cy coefficient for this plane.
 
Constructor Summary
Plane()
          Construct a new plane.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this plane.
 boolean equals(java.lang.Object object)
          Compare this plane with the specified object for equality.
 int hashCode()
          Returns a hash code value for this plane.
 void setPlane(double[] x, double[] y, double[] z)
          Compute the plane's coefficients from a set of points.
 void setPlane(javax.vecmath.Point3d P1, javax.vecmath.Point3d P2, javax.vecmath.Point3d P3)
          Computes the plane's coefficients from the specified points.
 java.lang.String toString()
          Returns a string representation of this plane.
 double x(double y, double z)
          Compute the x value for the specified (y,z) point.
 double y(double x, double z)
          Compute the y value for the specified (x,z) point.
 double z(double x, double y)
          Compute the z value for the specified (x,y) point.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

c

public double c
The c coefficient for this plane. This coefficient appears in the place equation c+cx*x+cy*y.


cx

public double cx
The cx coefficient for this plane. This coefficient appears in the place equation c+cx*x+cy*y.


cy

public double cy
The cy coefficient for this plane. This coefficient appears in the place equation c+cx*x+cy*y.

Constructor Detail

Plane

public Plane()
Construct a new plane. All coefficients are set to 0.

Method Detail

z

public final double z(double x,
                      double y)
Compute the z value for the specified (x,y) point. The z value is computed using the following equation:
z(x,y) = c + cx*x + cy*y

Parameters:
x - The x value.
y - The y value.
Returns:
The z value.

y

public final double y(double x,
                      double z)
Compute the y value for the specified (x,z) point. The y value is computed using the following equation:
y(x,z) = (z - (c+cx*x)) / cy

Parameters:
x - The x value.
z - The y value.
Returns:
The y value.

x

public final double x(double y,
                      double z)
Compute the x value for the specified (y,z) point. The x value is computed using the following equation:
x(y,z) = (z - (c+cy*y)) / cx

Parameters:
y - The x value.
z - The y value.
Returns:
The x value.

setPlane

public void setPlane(javax.vecmath.Point3d P1,
                     javax.vecmath.Point3d P2,
                     javax.vecmath.Point3d P3)
              throws java.lang.ArithmeticException
Computes the plane's coefficients from the specified points. Three points are enough for determining exactly the plan, providing that the points are not colinear.

Throws:
java.lang.ArithmeticException - If the three points are colinear.

setPlane

public void setPlane(double[] x,
                     double[] y,
                     double[] z)
              throws javax.vecmath.MismatchedSizeException
Compute the plane's coefficients from a set of points. This method use a linear regression in the least-square sense. Result is undertermined if all points are colinear.

Parameters:
x - vector of x coordinates
y - vector of y coordinates
z - vector of z values
Throws:
javax.vecmath.MismatchedSizeException - if x, y and z don't have the same length.

toString

public java.lang.String toString()
Returns a string representation of this plane. The string will contains the plane's equation, as below:
z(x,y) = c + cx*x + cy*y


equals

public boolean equals(java.lang.Object object)
Compare this plane with the specified object for equality.


hashCode

public int hashCode()
Returns a hash code value for this plane.


clone

public java.lang.Object clone()
Returns a clone of this plane.

Specified by:
clone in interface org.opengis.util.Cloneable


Copyright © GeoTools. All Rights Reserved.