Class SVGHyperCube


  • public final class SVGHyperCube
    extends java.lang.Object
    Utility class to draw hypercubes, wireframe and filled.
    Since:
    0.4.0
    Author:
    Erich Schubert
    • Constructor Detail

      • SVGHyperCube

        private SVGHyperCube()
        Private constructor. Static methods only.
    • Method Detail

      • drawFrame

        public static org.w3c.dom.Element drawFrame​(SVGPlot svgp,
                                                    Projection2D proj,
                                                    double[] min,
                                                    double[] max)
        Wireframe hypercube.
        Parameters:
        svgp - SVG Plot
        proj - Visualization projection
        min - First corner
        max - Opposite corner
        Returns:
        path element
      • drawFrame

        public static org.w3c.dom.Element drawFrame​(SVGPlot svgp,
                                                    Projection2D proj,
                                                    NumberVector min,
                                                    NumberVector max)
        Wireframe hypercube.
        Parameters:
        svgp - SVG Plot
        proj - Visualization projection
        min - First corner
        max - Opposite corner
        Returns:
        path element
      • drawFrame

        public static org.w3c.dom.Element drawFrame​(SVGPlot svgp,
                                                    Projection2D proj,
                                                    SpatialComparable box)
        Wireframe hypercube.
        Parameters:
        svgp - SVG Plot
        proj - Visualization projection
        box - Bounding box
        Returns:
        path element
      • drawFilled

        public static org.w3c.dom.Element drawFilled​(SVGPlot svgp,
                                                     java.lang.String cls,
                                                     Projection2D proj,
                                                     double[] min,
                                                     double[] max)
        Filled hypercube.
        Parameters:
        svgp - SVG Plot
        cls - CSS class to use.
        proj - Visualization projection
        min - First corner
        max - Opposite corner
        Returns:
        group element
      • drawFilled

        public static org.w3c.dom.Element drawFilled​(SVGPlot svgp,
                                                     java.lang.String cls,
                                                     Projection2D proj,
                                                     NumberVector min,
                                                     NumberVector max)
        Filled hypercube.
        Parameters:
        svgp - SVG Plot
        cls - CSS class to use.
        proj - Visualization projection
        min - First corner
        max - Opposite corner
        Returns:
        group element
      • drawFilled

        public static org.w3c.dom.Element drawFilled​(SVGPlot svgp,
                                                     java.lang.String cls,
                                                     Projection2D proj,
                                                     SpatialComparable box)
        Filled hypercube.
        Parameters:
        svgp - SVG Plot
        cls - CSS class to use.
        proj - Visualization projection
        box - Bounding box
        Returns:
        group element
      • getVisibleEdges

        private static java.util.ArrayList<double[]> getVisibleEdges​(Projection2D proj,
                                                                     double[] s_min,
                                                                     double[] s_max)
        Get the visible (non-0) edges of a hypercube
        Parameters:
        proj - Projection
        s_min - Minimum value (in data space)
        s_max - Maximum value (in data space)
        Returns:
        Edge list
      • getVisibleEdges

        private static java.util.ArrayList<double[]> getVisibleEdges​(Projection2D proj,
                                                                     NumberVector s_min,
                                                                     NumberVector s_max)
        Get the visible (non-0) edges of a hypercube
        Parameters:
        proj - Projection
        s_min - Minimum value (in data space)
        s_max - Maximum value (in data space)
        Returns:
        Edge list
      • getVisibleEdges

        private static java.util.ArrayList<double[]> getVisibleEdges​(Projection2D proj,
                                                                     SpatialComparable box)
        Get the visible (non-0) edges of a hypercube
        Parameters:
        proj - Projection
        box - Box object
        Returns:
        Edge list
      • recDrawEdges

        private static void recDrawEdges​(SVGPath path,
                                         double minx,
                                         double miny,
                                         java.util.List<double[]> r_edges,
                                         long[] b)
        Recursive helper for hypercube drawing.
        Parameters:
        path - path
        minx - starting corner
        miny - starting corner
        r_edges - edge vectors
        b - bit set of drawn edges
      • recDrawSides

        private static void recDrawSides​(SVGPlot plot,
                                         org.w3c.dom.Element group,
                                         java.lang.String cls,
                                         double minx,
                                         double miny,
                                         java.util.List<double[]> r_edges,
                                         long[] b)
        Recursive helper for hypercube drawing.
        Parameters:
        plot - Plot
        group - Group element
        cls - CSS class
        minx - starting corner
        miny - starting corner
        r_edges - edge vectors
        b - bit set of drawn edges
      • isFinite

        private static boolean isFinite​(double v)
        Finite (and not NaN) double values.
        Parameters:
        v - Value
        Returns:
        true, when finite.