public class Plane extends Object implements Cloneable, Serializable
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.
Line
,
LinearTransformBuilder
,
Serialized FormDefined in the sis-utility
module
Constructor and Description |
---|
Plane()
Constructs a new plane with all coefficients initialized to
Double.NaN . |
Plane(double sx,
double sy,
double z0)
Constructs a new plane initialized to the given coefficients.
|
Modifier and Type | Method and Description |
---|---|
Plane |
clone()
Returns a clone of this plane.
|
boolean |
equals(Object object)
Compares this plane with the specified object for equality.
|
double |
fit(double[] x,
double[] y,
double[] z)
Computes the plane's coefficients from the given ordinate values.
|
double |
fit(int nx,
int ny,
Vector z)
Computes the plane's coefficients from values distributed on a regular grid.
|
double |
fit(Iterable<? extends DirectPosition> points)
Computes the plane's coefficients from the given sequence of points.
|
double |
fit(Vector x,
Vector y,
Vector z)
Computes the plane's coefficients from the given ordinate values.
|
int |
hashCode()
Returns a hash code value for this plane.
|
void |
setEquation(double sx,
double sy,
double z0)
Sets the equation of this plane to the given coefficients.
|
void |
setEquation(Number sx,
Number sy,
Number z0)
Sets this plane from values of arbitrary
Number type. |
double |
slopeX()
Returns the slope along the x values.
|
double |
slopeY()
Returns the slope along the y values.
|
String |
toString()
Returns a string representation of this plane.
|
double |
x(double y,
double z)
Computes the x value for the specified (y,z) point.
|
double |
y(double x,
double z)
Computes the y value for the specified (x,z) point.
|
double |
z(double x,
double y)
Computes the z value for the specified (x,y) point.
|
double |
z0()
Returns the z value at (x,y) = (0,0).
|
public Plane()
Double.NaN
.public Plane(double sx, double sy, double z0)
sx
- the slope along the x values.sy
- the slope along the y values.z0
- the z value at (x,y) = (0,0).setEquation(double, double, double)
public final double slopeX()
public final double slopeY()
public final double z0()
z(double, double)
public final double x(double y, double z)
x(y,z) = (z - (z₀ + sy⋅y)) / sx
y
- the y value where to compute x.z
- the z value where to compute x.public final double y(double x, double z)
y(x,z) = (z - (z₀ + sx⋅x)) / sy
x
- the x value where to compute y.z
- the z value where to compute y.public final double z(double x, double y)
z(x,y) = sx⋅x + sy⋅y + z₀
x
- the x value where to compute z.y
- the y value where to compute z.z0()
public void setEquation(double sx, double sy, double z0)
sx
- the slope along the x values.sy
- the slope along the y values.z0
- the z value at (x,y) = (0,0).public void setEquation(Number sx, Number sy, Number z0)
Number
type. This method is invoked by algorithms that
may produce other kind of numbers (for example with different precision) than the usual double
primitive type. The default implementation delegates to setEquation(double, double, double)
,
but subclasses can override this method if they want to process other kind of numbers in a special way.sx
- the slope along the x values.sy
- the slope along the y values.z0
- the z value at (x,y) = (0,0).public double fit(double[] x, double[] y, double[] z)
Double.NaN
values are ignored. The result is undetermined if all points are colinear.
The default implementation delegates to fit(Vector, Vector, Vector)
.
x
- vector of x coordinates.y
- vector of y coordinates.z
- vector of z values.IllegalArgumentException
- if x, y and z do not have the same length.public double fit(Vector x, Vector y, Vector z)
Double.NaN
values are ignored. The result is undetermined if all points are colinear.
The default implementation delegates to fit(Iterable)
.
x
- vector of x coordinates.y
- vector of y coordinates.z
- vector of z values.IllegalArgumentException
- if x, y and z do not have the same length.public double fit(int nx, int ny, Vector z)
fit(Vector, Vector, Vector)
where all
vectors have a length of nx
× ny
and 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 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
nx
- number of columns.ny
- number of rows.z
- values of a matrix of nx
columns by ny
rows organized in a row-major fashion.IllegalArgumentException
- if z does not have the expected length or if a z
value is Double.NaN
.public double fit(Iterable<? extends DirectPosition> points)
Double.NaN
values are ignored. The result is undetermined if all points are colinear.points
- the three-dimensional points.MismatchedDimensionException
- if a point is not three-dimensional.public Plane clone()
public boolean equals(Object object)
public int hashCode()
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.