Package org.apache.sis.math
Class Plane
Object
Plane
- All Implemented Interfaces:
- Serializable,- Cloneable,- DoubleBinaryOperator
Equation of a plane in a three-dimensional space (x,y,z).
 The plane equation is expressed by sx, sy and
 z₀ coefficients as below:
 
z(x,y) = sx⋅x + sy⋅y + z₀Those coefficients can be set directly, or computed by a linear regression of this plane through a set of three-dimensional points.
- Since:
- 0.5
- See Also:
Defined in the sis-utility module
- 
Constructor SummaryConstructorsConstructorDescriptionPlane()Constructs a new plane with all coefficients initialized toDouble.NaN.Plane(double sx, double sy, double z0) Constructs a new plane initialized to the given coefficients.
- 
Method SummaryModifier and TypeMethodDescriptiondoubleapplyAsDouble(double x, double y) Evaluates this equation for the given values.clone()Returns a clone of this plane.booleanCompares this plane with the specified object for equality.doublefit(double[] x, double[] y, double[] z) Computes the plane's coefficients from the given coordinate values.doubleComputes the plane's coefficients from values distributed on a regular grid.doublefit(Iterable<? extends DirectPosition> points) Computes the plane's coefficients from the given sequence of points.doubleComputes the plane's coefficients from the given coordinate values.intReturns a hash code value for this plane.voidsetEquation(double sx, double sy, double z0) Sets the equation of this plane to the given coefficients.voidsetEquation(Number sx, Number sy, Number z0) Sets this plane from values of arbitraryNumbertype.final doubleslopeX()Returns the slope along the x values.final doubleslopeY()Returns the slope along the y values.Returns a string representation of this plane.final doublex(double y, double z) Computes the x value for the specified (y,z) point.final doubley(double x, double z) Computes the y value for the specified (x,z) point.final doublez(double x, double y) Computes the z value for the specified (x,y) point.final doublez0()Returns the z value at (x,y) = (0,0).
- 
Constructor Details- 
Planepublic Plane()Constructs a new plane with all coefficients initialized toDouble.NaN.
- 
Planepublic Plane(double sx, double sy, double z0) Constructs a new plane initialized to the given coefficients.- Parameters:
- sx- the slope along the x values.
- sy- the slope along the y values.
- z0- the z value at (x,y) = (0,0).
- See Also:
 
 
- 
- 
Method Details- 
slopeXpublic final double slopeX()Returns the slope along the x values. This coefficient appears in the plane equation sx⋅x + sy⋅y + z₀.- Returns:
- the sx term.
 
- 
slopeYpublic final double slopeY()Returns the slope along the y values. This coefficient appears in the plane equation sx⋅x + sy⋅y + z₀.- Returns:
- the sy term.
 
- 
z0public final double z0()Returns the z value at (x,y) = (0,0). This coefficient appears in the plane equation sx⋅x + sy⋅y + z₀.- Returns:
- the z₀ term.
- See Also:
 
- 
xpublic final double x(double y, double z) Computes the x value for the specified (y,z) point. The x value is computed using the following equation:x(y,z) = (z - (z₀ + sy⋅y)) / sx - Parameters:
- y- the y value where to compute x.
- z- the z value where to compute x.
- Returns:
- the x value.
 
- 
ypublic final double y(double x, double z) Computes the y value for the specified (x,z) point. The y value is computed using the following equation:y(x,z) = (z - (z₀ + sx⋅x)) / sy - Parameters:
- x- the x value where to compute y.
- z- the z value where to compute y.
- Returns:
- the y value.
 
- 
zpublic final double z(double x, double y) Computes the z value for the specified (x,y) point. The z value is computed using the following equation:z(x,y) = sx⋅x + sy⋅y + z₀ - Parameters:
- x- the x value where to compute z.
- y- the y value where to compute z.
- Returns:
- the z value.
- See Also:
 
- 
applyAsDoublepublic double applyAsDouble(double x, double y) Evaluates this equation for the given values. The default implementation delegates toz(x,y), but subclasses may override with different formulas. This method is provided for interoperability with libraries making use ofjava.util.function.- Specified by:
- applyAsDoublein interface- DoubleBinaryOperator
- Parameters:
- x- the first operand where to evaluate the function.
- y- the second operand where to evaluate the function.
- Returns:
- the function value for the given operands.
- Since:
- 1.0
 
- 
setEquationpublic void setEquation(double sx, double sy, double z0) Sets the equation of this plane to the given coefficients.- Parameters:
- sx- the slope along the x values.
- sy- the slope along the y values.
- z0- the z value at (x,y) = (0,0).
 
- 
setEquationSets this plane from values of arbitraryNumbertype. This method is invoked by algorithms that may produce other kind of numbers (for example with different precision) than the usualdoubleprimitive type. The default implementation delegates tosetEquation(double, double, double), but subclasses can override this method if they want to process other kind of numbers in a special way.- Parameters:
- sx- the slope along the x values.
- sy- the slope along the y values.
- z0- the z value at (x,y) = (0,0).
- Since:
- 0.8
 
- 
fitpublic double fit(double[] x, double[] y, double[] z) Computes the plane's coefficients from the given coordinate values. This method uses a linear regression in the least-square sense, with the assumption that the (x,y) values are precise and all uncertainty is in z.Double.NaNvalues are ignored. The result is undetermined if all points are colinear.The default implementation delegates to fit(Vector, Vector, Vector).- Parameters:
- x- vector of x coordinates.
- y- vector of y coordinates.
- z- vector of z values.
- Returns:
- an estimation of the Pearson correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.
- Throws:
- IllegalArgumentException- if x, y and z do not have the same length.
 
- 
fitComputes the plane's coefficients from the given coordinate values. This method uses a linear regression in the least-square sense, with the assumption that the (x,y) values are precise and all uncertainty is in z.Double.NaNvalues are ignored. The result is undetermined if all points are colinear.The default implementation delegates to fit(Iterable).- Parameters:
- x- vector of x coordinates.
- y- vector of y coordinates.
- z- vector of z values.
- Returns:
- an estimation of the Pearson correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.
- Throws:
- IllegalArgumentException- if x, y and z do not have the same length.
- Since:
- 0.8
 
- 
fitComputes the plane's coefficients from values distributed on a regular grid. Invoking this method is equivalent (except for NaN handling) to invokingfit(Vector, Vector, Vector)where all vectors have a length ofnx×nyand the x and y vectors have the following content:
 This method uses a linear regression in the least-square sense, with the assumption that the (x,y) values are precise and all uncertainty is in z. The result is undetermined if all points are colinear.x and y vectors content x vector y vector 0 1 2 3 4 5 … nx-1 
 0 1 2 3 4 5 … nx-1
 0 1 2 3 4 5 … nx-1
 …
 0 1 2 3 4 5 … nx-1
 0 0 0 0 0 0 … 0 
 1 1 1 1 1 1 … 1
 2 2 2 2 2 2 … 2
 …
 ny-1 ny-1 ny-1 … ny-1
 - Parameters:
- nx- number of columns.
- ny- number of rows.
- z- values of a matrix of- nxcolumns by- nyrows organized in a row-major fashion.
- Returns:
- an estimation of the Pearson correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.
- Throws:
- IllegalArgumentException- if z does not have the expected length or if a z value is- Double.NaN.
- Since:
- 0.8
 
- 
fitComputes the plane's coefficients from the given sequence of points. This method uses a linear regression in the least-square sense, with the assumption that the (x,y) values are precise and all uncertainty is in z. Points shall be three dimensional with coordinate values in the (x,y,z) order.Double.NaNvalues are ignored. The result is undetermined if all points are colinear.- Parameters:
- points- the three-dimensional points.
- Returns:
- an estimation of the Pearson correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.
- Throws:
- MismatchedDimensionException- if a point is not three-dimensional.
 
- 
cloneReturns a clone of this plane.
- 
equalsCompares this plane with the specified object for equality.
- 
hashCodepublic int hashCode()Returns a hash code value for this plane.
- 
toString
 
-