Package elki.visualization.projections
Class AffineProjection
- java.lang.Object
-
- elki.visualization.projections.AbstractProjection
-
- elki.visualization.projections.AbstractFullProjection
-
- elki.visualization.projections.AffineProjection
-
- All Implemented Interfaces:
FullProjection
,Projection
,Projection2D
,VisualizationItem
public class AffineProjection extends AbstractFullProjection implements Projection2D
Affine projections are the most general class. They are initialized by an arbitrary affine transformation matrix, and can thus represent any rotation and scaling, even simple perspective projections. However, this comes at the cost of a matrix multiplication.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private AffineTransformation
proj
Affine transformation used in projectionprivate CanvasSize
viewport
Viewport (cache)-
Fields inherited from class elki.visualization.projections.AbstractProjection
scales
-
Fields inherited from interface elki.visualization.projections.Projection
INVSCALE, SCALE
-
-
Constructor Summary
Constructors Constructor Description AffineProjection(Projector p, LinearScale[] scales, AffineTransformation proj)
Constructor with a given database and axes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AffineTransformation
axisProjection(int dim, int ax1, int ax2)
Compute an transformation matrix to show only axis ax1 and ax2.CanvasSize
estimateViewport()
Estimate the viewport requirementsdouble[]
fastProjectDataToRenderSpace(double[] data)
Project a data vector from data space to rendering space.double[]
fastProjectDataToRenderSpace(NumberVector data)
Project a data vector from data space to rendering space.double[]
fastProjectDataToScaledSpace(double[] data)
Project a data vector from data space to scaled space.double[]
fastProjectDataToScaledSpace(NumberVector data)
Project a data vector from data space to scaled space.double[]
fastProjectRelativeDataToRenderSpace(double[] data)
Project a data vector from data space to rendering space.double[]
fastProjectRelativeDataToRenderSpace(NumberVector data)
Project a data vector from data space to rendering space.double[]
fastProjectRelativeScaledToRenderSpace(double[] vr)
Project a vector from scaled space to rendering space.double[]
fastProjectRenderToDataSpace(double x, double y)
Project a data vector from rendering space to data space.double[]
fastProjectRenderToScaledSpace(double x, double y)
Project a vector from rendering space to scaled space.double[]
fastProjectScaledToRenderSpace(double[] vr)
Project a vector from scaled space to rendering space.long[]
getVisibleDimensions2D()
Get a bit set of dimensions that are visible.double[]
projectRelativeRenderToScaled(double[] v)
Project a relative vector from rendering space to scaled space.double[]
projectRelativeScaledToRender(double[] v)
Project a relative vector from scaled space to rendering space.double[]
projectRenderToScaled(double[] v)
Project a vector from rendering space to scaled space.double[]
projectScaledToRender(double[] v)
Project a vector from scaled space to rendering space.-
Methods inherited from class elki.visualization.projections.AbstractFullProjection
projectDataToRenderSpace, projectDataToRenderSpace, projectDataToScaledSpace, projectDataToScaledSpace, projectRelativeDataToRenderSpace, projectRelativeDataToRenderSpace, projectRelativeDataToScaledSpace, projectRelativeDataToScaledSpace, projectRelativeRenderToDataSpace, projectRelativeScaledToDataSpace, projectRenderToDataSpace, projectScaledToDataSpace
-
Methods inherited from class elki.visualization.projections.AbstractProjection
getInputDimensionality, getMenuName, getProjector, getScale
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.visualization.projections.Projection
getInputDimensionality, getProjector, getScale
-
Methods inherited from interface elki.visualization.VisualizationItem
getMenuName
-
-
-
-
Field Detail
-
proj
private AffineTransformation proj
Affine transformation used in projection
-
viewport
private CanvasSize viewport
Viewport (cache)
-
-
Constructor Detail
-
AffineProjection
public AffineProjection(Projector p, LinearScale[] scales, AffineTransformation proj)
Constructor with a given database and axes.- Parameters:
p
- Projectorscales
- Scales to useproj
- Projection to use
-
-
Method Detail
-
projectScaledToRender
public double[] projectScaledToRender(double[] v)
Project a vector from scaled space to rendering space.- Specified by:
projectScaledToRender
in interfaceFullProjection
- Parameters:
v
- vector in scaled space- Returns:
- vector in rendering space
-
projectRenderToScaled
public double[] projectRenderToScaled(double[] v)
Project a vector from rendering space to scaled space.- Specified by:
projectRenderToScaled
in interfaceFullProjection
- Parameters:
v
- vector in rendering space- Returns:
- vector in scaled space
-
projectRelativeScaledToRender
public double[] projectRelativeScaledToRender(double[] v)
Project a relative vector from scaled space to rendering space.- Specified by:
projectRelativeScaledToRender
in interfaceFullProjection
- Parameters:
v
- relative vector in scaled space- Returns:
- relative vector in rendering space
-
projectRelativeRenderToScaled
public double[] projectRelativeRenderToScaled(double[] v)
Project a relative vector from rendering space to scaled space.- Specified by:
projectRelativeRenderToScaled
in interfaceFullProjection
- Parameters:
v
- relative vector in rendering space- Returns:
- relative vector in scaled space
-
estimateViewport
public CanvasSize estimateViewport()
Description copied from interface:Projection2D
Estimate the viewport requirements- Specified by:
estimateViewport
in interfaceProjection2D
- Returns:
- Canvas size obtained from projecting scale endpoints
-
axisProjection
public static AffineTransformation axisProjection(int dim, int ax1, int ax2)
Compute an transformation matrix to show only axis ax1 and ax2.- Parameters:
dim
- Dimensionalityax1
- First axisax2
- Second axis- Returns:
- transformation matrix
-
fastProjectDataToRenderSpace
public double[] fastProjectDataToRenderSpace(double[] data)
Description copied from interface:Projection2D
Project a data vector from data space to rendering space.- Specified by:
fastProjectDataToRenderSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in rendering space
-
fastProjectDataToRenderSpace
public double[] fastProjectDataToRenderSpace(NumberVector data)
Description copied from interface:Projection2D
Project a data vector from data space to rendering space.- Specified by:
fastProjectDataToRenderSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in rendering space
-
fastProjectDataToScaledSpace
public double[] fastProjectDataToScaledSpace(double[] data)
Description copied from interface:Projection2D
Project a data vector from data space to scaled space.- Specified by:
fastProjectDataToScaledSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in scaled space
-
fastProjectDataToScaledSpace
public double[] fastProjectDataToScaledSpace(NumberVector data)
Description copied from interface:Projection2D
Project a data vector from data space to scaled space.- Specified by:
fastProjectDataToScaledSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in scaled space
-
fastProjectScaledToRenderSpace
public double[] fastProjectScaledToRenderSpace(double[] vr)
Description copied from interface:Projection2D
Project a vector from scaled space to rendering space.- Specified by:
fastProjectScaledToRenderSpace
in interfaceProjection2D
- Parameters:
vr
- vector in scaled space- Returns:
- vector in rendering space
-
fastProjectRelativeDataToRenderSpace
public double[] fastProjectRelativeDataToRenderSpace(double[] data)
Description copied from interface:Projection2D
Project a data vector from data space to rendering space.- Specified by:
fastProjectRelativeDataToRenderSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in rendering space
-
fastProjectRelativeDataToRenderSpace
public double[] fastProjectRelativeDataToRenderSpace(NumberVector data)
Description copied from interface:Projection2D
Project a data vector from data space to rendering space.- Specified by:
fastProjectRelativeDataToRenderSpace
in interfaceProjection2D
- Parameters:
data
- vector in data space- Returns:
- vector in rendering space
-
fastProjectRelativeScaledToRenderSpace
public double[] fastProjectRelativeScaledToRenderSpace(double[] vr)
Description copied from interface:Projection2D
Project a vector from scaled space to rendering space.- Specified by:
fastProjectRelativeScaledToRenderSpace
in interfaceProjection2D
- Parameters:
vr
- vector in scaled space- Returns:
- vector in rendering space
-
fastProjectRenderToDataSpace
public double[] fastProjectRenderToDataSpace(double x, double y)
Description copied from interface:Projection2D
Project a data vector from rendering space to data space.- Specified by:
fastProjectRenderToDataSpace
in interfaceProjection2D
- Parameters:
x
- X coordinatey
- Y coordinate- Returns:
- vector in data space
-
fastProjectRenderToScaledSpace
public double[] fastProjectRenderToScaledSpace(double x, double y)
Description copied from interface:Projection2D
Project a vector from rendering space to scaled space.- Specified by:
fastProjectRenderToScaledSpace
in interfaceProjection2D
- Parameters:
x
- X coordinatey
- Y coordinate- Returns:
- vector in scaled space
-
getVisibleDimensions2D
public long[] getVisibleDimensions2D()
Description copied from interface:Projection2D
Get a bit set of dimensions that are visible.- Specified by:
getVisibleDimensions2D
in interfaceProjection2D
- Returns:
- Bit set, first dimension is bit 0.
-
-