@Beta @GwtIncompatible public abstract class LinearTransformation extends Object
x
and y
.
Graphically, this is the specification of a straight line on a plane. The transformation can be
expressed as y = m * x + c
for finite m
and c
, unless it is a vertical
transformation in which case x
has a constant value for all y
. In the
non-vertical case, m
is the slope of the transformation (and a horizontal transformation
has zero slope).Modifier and Type | Class and Description |
---|---|
static class |
LinearTransformation.LinearTransformationBuilder
This is an intermediate stage in the construction process.
|
Constructor and Description |
---|
LinearTransformation() |
Modifier and Type | Method and Description |
---|---|
static LinearTransformation |
forNaN()
Builds an instance for datasets which contains
Double.NaN . |
static LinearTransformation |
horizontal(double y)
Builds an instance representing a horizontal transformation with a constant value of
y . |
abstract LinearTransformation |
inverse()
Returns the inverse linear transformation.
|
abstract boolean |
isHorizontal()
Returns whether this is a horizontal transformation.
|
abstract boolean |
isVertical()
Returns whether this is a vertical transformation.
|
static LinearTransformation.LinearTransformationBuilder |
mapping(double x1,
double y1)
Start building an instance which maps
x = x1 to y = y1 . |
abstract double |
slope()
Returns the slope of the transformation, i.e.
|
abstract double |
transform(double x)
Returns the
y corresponding to the given x . |
static LinearTransformation |
vertical(double x)
Builds an instance representing a vertical transformation with a constant value of
x . |
public LinearTransformation()
public static LinearTransformation.LinearTransformationBuilder mapping(double x1, double y1)
x = x1
to y = y1
. Both arguments must be
finite. Call either LinearTransformation.LinearTransformationBuilder.and(double, double)
or LinearTransformation.LinearTransformationBuilder.withSlope(double)
on the returned object to finish building the instance.public static LinearTransformation vertical(double x)
x
.
(The inverse of this will be a horizontal transformation.)public static LinearTransformation horizontal(double y)
y
.
(The inverse of this will be a vertical transformation.)public static LinearTransformation forNaN()
Double.NaN
. The isHorizontal()
and isVertical()
methods return false
and the slope()
, and transform(double)
methods all return Double.NaN
. The inverse()
method returns the same
instance.public abstract boolean isVertical()
public abstract boolean isHorizontal()
public abstract double slope()
y
with respect to
x
. This must not be called on a vertical transformation (i.e. when isVertical()
is true).public abstract double transform(double x)
y
corresponding to the given x
. This must not be called on a
vertical transformation (i.e. when isVertical()
is true).public abstract LinearTransformation inverse()
forNaN()
transformation is
itself. In all other cases, the inverse is a transformation such that applying both the
original transformation and its inverse to a value gives you the original value give-or-take
numerical errors. Calling this method multiple times on the same instance will always return
the same instance. Calling this method on the result of calling this method on an instance will
always return that original instance.Copyright © 2010–2017. All rights reserved.