Class 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
    • Constructor Detail

      • AffineProjection

        public AffineProjection​(Projector p,
                                LinearScale[] scales,
                                AffineTransformation proj)
        Constructor with a given database and axes.
        Parameters:
        p - Projector
        scales - Scales to use
        proj - Projection to use
    • Method Detail

      • projectScaledToRender

        public double[] projectScaledToRender​(double[] v)
        Project a vector from scaled space to rendering space.
        Specified by:
        projectScaledToRender in interface FullProjection
        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 interface FullProjection
        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 interface FullProjection
        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 interface FullProjection
        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 interface Projection2D
        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 - Dimensionality
        ax1 - First axis
        ax2 - 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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        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 interface Projection2D
        Parameters:
        x - X coordinate
        y - 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 interface Projection2D
        Parameters:
        x - X coordinate
        y - 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 interface Projection2D
        Returns:
        Bit set, first dimension is bit 0.