Documentation of 'jhplot.HPlotXYZ' Java class.
HPlotXYZ
jhplot

Class HPlotXYZ

  • All Implemented Interfaces:
    java.awt.event.ComponentListener, java.io.Serializable, java.util.EventListener


    public class HPlotXYZ
    extends GHFrame
    Create a interactive canvas to show objects in 3D. This canvas uses the GL native libraries. Use it for showing 2D histograms (H2D class), functions (F2D), data points (P2D class).
    See Also:
    Serialized Form
    • Field Detail

      • set

        public boolean set
    • Constructor Detail

      • HPlotXYZ

        public HPlotXYZ(java.lang.String title,
                        int xsize,
                        int ysize,
                        int n1,
                        int n2,
                        boolean set)
        Create a canvas to display histograms in 3D
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        n1 - number of plots/graphs in x
        n2 - number of plots in y
      • HPlotXYZ

        public HPlotXYZ(java.lang.String title,
                        int xsize,
                        int ysize,
                        int n1,
                        int n2)
        Create a canvas to display histograms in 3D
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        n1 - number of plots/graphs in x
        n2 - number of plots/graphs in y
        set - set or not the graph
      • HPlotXYZ

        public HPlotXYZ(java.lang.String title,
                        int xs,
                        int ys)
        Construct a HView2D canvas with a single plot/graph
        Parameters:
        title - Title for the canvas
        xs - size in x
        ys - size in y
      • HPlotXYZ

        public HPlotXYZ(java.lang.String title)
        Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global title
        Parameters:
        title - Title
      • HPlotXYZ

        public HPlotXYZ()
        Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global title "Default"
    • Method Detail

      • setRange

        public void setRange(double minX,
                             double maxX,
                             double minY,
                             double maxY,
                             double minZ,
                             double maxZ)
        Sets the range for the current plot
        Parameters:
        minX - Min value in X
        maxX - Max value in X
        minY - Min value in Y
        maxY - Max value in Y
        minZ - Min value in Z
        maxZ - Max value in Z
      • setFontAxisTicks

        public void setFontAxisTicks(int font)
        Set fonts for tick labels in terms of GLUT.BITMAP fonts.
        Parameters:
        font - font in terms GLUT.BITMAP
      • setAxisPenWidth

        public void setAxisPenWidth(int pwidth)
        Set line width to draw boxes and axis.
        Parameters:
        pwidth - with of the pen to draw boxes etc.
      • getFontAxisTicks

        public int getFontAxisTicks()
        Get fonts for axis ticks in terms of GLUT.BITMAP fonts.
        Returns:
        font font in terms GLUT.BITMAP
      • getFontAxisLabels

        public int getFontAxisLabels()
        Get fonts for axis labels in terms of GLUT.BITMAP fonts.
        Returns:
        font font in terms GLUT.BITMAP
      • animate

        public CameraThreadController animate()
        Start animation of the current canvas.
        Returns:
        animation;
      • setColorFill

        public void setColorFill(java.awt.Color color)
        Set fill color for the current object
        Parameters:
        color - to fill object
      • setColorWireframe

        public void setColorWireframe(java.awt.Color color)
        Set fill color for the current object
        Parameters:
        color - for wireframe
      • setWireframe

        public void setWireframe(boolean wiredrame)
        Set wireframe mode for the current object.
        Parameters:
        wiredrame - true than no solid fill is used.
      • setWireframeWidth

        public void setWireframeWidth(double width)
        Set width of the line for wireframe
        Parameters:
        width - width
      • setColorSolid

        public void setColorSolid(boolean solid)
        If you set true, color will be solid and no colorfull color map is used.
        Parameters:
        solid - apply a solid color to the current object
      • getView

        public View getView()
        Get current view of the plotted object.
        Returns:
        view
      • setScale

        public void setScale(double scale)
        Set the scaling for the current image box.
        Parameters:
        scale - scaling factor for the image.
      • zoom

        public void zoom(double scale)
        Set the scaling for the axis of the current object. Use setScale() to change image size.
        Parameters:
        scale - scaling factor for the object
      • setRotationAngle

        public void setRotationAngle(double angle)
        Get the rotation angle
        Parameters:
        angle - angle
      • setFaceDisplayed

        public void setFaceDisplayed(boolean face)
        Set face shown or not
        Parameters:
        face - true is displayed.
      • setGridColor

        public void setGridColor(java.awt.Color co)
        Set Grid color to the current pad
        Parameters:
        co - grid color
      • visible

        public void visible(int posX,
                            int posY)
        Set the canvas frame visible. Also set its location.
        Parameters:
        posX - - the x-coordinate of the new location's top-left corner in the parent's coordinate space;
        posY - - he y-coordinate of the new location's top-left corner in the parent's coordinate space
      • clear

        public void clear()
        Clear the current graph including graph settings. Note: the current graph is set by the cd() method
      • clear

        public void clear(int i1,
                          int i2)
        Clear the graph characterized by an index in X and Y. This method cleans the data and all graph settings.
        Parameters:
        i1 - location of the graph in X
        i2 - location of the graph in Y
      • clearAll

        public void clearAll()
        Clear all graphs from data and settings.
      • distroy

        public void distroy()
        Remove the canvas frame
      • quit

        public void quit()
        exit the frame and clear all components
      • visible

        public void visible(boolean vs)
        Set the canvas frame visible or not
        Parameters:
        vs - (boolean) true: visible, false: not visible
      • visible

        public void visible()
        Show the canvas
      • setNameX

        public void setNameX(java.lang.String a)
        Set a name for X axis
        Parameters:
        a - Name of the label for X axis
      • setNameY

        public void setNameY(java.lang.String a)
        Set a name for Y axis
        Parameters:
        a - Name of the label for Y axis
      • setNameZ

        public void setNameZ(java.lang.String a)
        Set a name for Z axis
        Parameters:
        a - Name of the label for Z axis
      • setAxesLabel

        public void setAxesLabel(int axis,
                                 boolean shown)
        Show or not label on axes.
        Parameters:
        axis - axis: 0 for X, 1 for Y, 2 for Z
        shown - true then shown.
      • setViewPoint

        public void setViewPoint(double x,
                                 double y,
                                 double z)
        Set view point
        Parameters:
        x - X
        y - Y
        z - Z
      • setAxesLabelFont

        public void setAxesLabelFont(java.awt.Font font,
                                     Color color)
        Set font and color for axis labels.
        Parameters:
        font -
        color -
      • setContourMesh3D

        public void setContourMesh3D(boolean contour)
        Set (or not) contour mesh style to 3D plots.
        Parameters:
        contour - set to true for a contour style
      • setContourColor3D

        public void setContourColor3D(boolean contour)
        Add (or not) contour color to 3D plot.
        Parameters:
        contour - set to true for a contour color style
      • setContourLevels

        public void setContourLevels(int nlevels)
        Set number of levels for contour plots.
        Parameters:
        nlevels - number of levels for contour plots.
      • getContourLevels

        public int getContourLevels()
        Get number of levels for contour plots.
        Returns:
        number of levels for contour plots.
      • setContourMesh3D

        public void setContourMesh3D()
        Set to contour mesh style to 3D plots.
      • setContourColor3D

        public void setContourColor3D()
        Set to contour color style to 3D plots.
      • getContourMesh3D

        public boolean getContourMesh3D()
        Get to contour mesh style from 3D plots.
      • setAxisTick

        public void setAxisTick(int axis,
                                boolean shown)
        Show or not ticks on axes.
        Parameters:
        axis - axis: 0 for X, 1 for Y, 2 for Z
        shown - true then shown.
      • add

        public void add(P2D h1)
        Add a container with X,Y.Z values to be shown. Call update() method to draw all objects.
        Parameters:
        h1 -
      • add

        public AbstractDrawable add(P2D h1,
                                    java.awt.Color color)
        Add a container with X,Y.Z values to be shown. Call update() method to draw all objects.
        Parameters:
        h1 -
        color - Color of this data.
      • add

        public AbstractDrawable add(P2D h1,
                                    double pointSize)
        Add a container with X,Y.Z values to be shown. Call update() method to draw all objects.
        Parameters:
        h1 - input data
        pointSize - size of the point
      • draw

        public AbstractDrawable draw(P2D h1,
                                     double penSize,
                                     java.awt.Color color)
        Draw X,Y.Z values in 3D using variable colors. Better use "add()" method to add the data to canvas.
        Parameters:
        h1 -
        penSize - size of the points
        color - to show points
      • add

        public AbstractDrawable add(P2D h1,
                                    double penSize,
                                    java.awt.Color color)
        Draw X,Y.Z values in 3D
        Parameters:
        h1 - input data
        penSize - size of the points
        color - to show points
        Returns:
        return added object for styling
      • draw

        public void draw(AbstractDrawable[] shapes)
        Draw a list of shapes on the current canvas
        Parameters:
        shapes -
      • update

        public void update()
        Update current pad. All objects added with the method "add" will be shown.
      • update

        public void update(int n1,
                           int n2)
        Refresh only a particular pad.
        Parameters:
        n1 - the location of the plot in x
        n2 - the location of the plot in y
      • updateAll

        public void updateAll()
        Refresh all the plots on the same canvas. Inactive.
      • addText

        public AbstractDrawable addText(java.lang.String text,
                                        double[] pos,
                                        java.awt.Color co)
        Add a text to the canvas.
        Parameters:
        text - text
        pos - position (x,y,z)
        color - color
        Returns:
        return what is added
      • add

        public AbstractDrawable add(F2D f)
        Add a F2D function (a function with 2 arguments, x and y). The function will be shows as a surface. This function is plotted with 50 steps in X and Y. Min and Max values for axes taken from the definition.
        Parameters:
        f - function to show
        Returns:
        added object for styling
      • add

        public AbstractDrawable add(F2D f,
                                    double xmin,
                                    double xmax,
                                    double ymin,
                                    double ymax)
        Add a F2D function (a function with 2 arguments, x and y). The function will be shows as a surface. This function is plotted with 40 steps in X and Y.
        Parameters:
        f - function to show
        xmin -
        xmax -
        ymin -
        ymax -
        Returns:
        object for styling
      • add

        public AbstractDrawable add(F2D h1,
                                    int xsteps,
                                    int ysteps,
                                    double xmin,
                                    double xmax,
                                    double ymin,
                                    double ymax)
        Add a F2D function (a function with 2 arguments, x and y). The function will be shows as a surface. Use "update()" method to draw it.
        Parameters:
        h1 -
        xsteps - number of divisions in X
        ysteps - number of divisions in Y
        xmin - min X
        xmax - max X
        ymin - min Y
        ymax - max Y
        Returns:
      • addAsSurface

        public AbstractDrawable addAsSurface(H2D h2d)
        Add a H2D histogram. The histogram will be shows as a surface. Use "update()" method to draw it.
        Parameters:
        h2d - Histogram for drawing.
        return - what was added
      • add

        public void add(H2D h2d)
        Show H2D histogram as bars
        Parameters:
        h2d - input histogram
        return - what was added
      • export

        public void export(java.lang.String file)
        Fast export of the canvas to an image file (depends on the extension, i.e. PNG, JPG). No questions will be asked, an existing file will be rewritten. Only one image allowed at the time.
        Overrides:
        export in class GHPanel
        Parameters:
        file - Output file with the proper extension. If no extension, PNG file is assumed.
      • addAsBars

        public void addAsBars(H2D h2d)
        Add a H2D histogram as bars. The histogram will be shows as a surface. Use "update()" method to draw it.
        Parameters:
        h2d - Histogram for drawing.
      • setLegendBar

        public void setLegendBar()
        Set a legend to a given surface.
        Parameters:
        surface - input object
      • draw

        public AbstractDrawable draw(H2D h2d)
        Draw a H2D histogram. Better use "add" to overlay histograms. Then use "update()" method to draw it.
        Parameters:
        h2d - Histogram for drawing.
      • getChart

        public Chart getChart()
        Get the current canvas chart.
        Returns:
        current chart.
      • setBackground

        public void setBackground(java.awt.Color co)
        Set background for the current pad.
        Parameters:
        co - color to be set
      • setTickScientific

        public void setTickScientific(int axis,
                                      int dig)
        Set scientific notation with a given number of digits.
        Parameters:
        axis - axis. 0=X, 1=Y, 2=Z
        dig - number of digits
      • setTickDecimal

        public void setTickDecimal(int axis,
                                   int dig)
        Set decimal precision for a given axis.
        Parameters:
        axis - axis. 0=X, 1=Y, 2=Z
        dig - precision.
      • setTickScientificAll

        public void setTickScientificAll(int dig)
        Set scientific notation with a given number of digits for all ticks.
        Parameters:
        dig - number of digits
      • setTickDecimalAll

        public void setTickDecimalAll(int dig)
        Set decimal notation with a given number of digits for all ticks.
        Parameters:
        dig - number of digits
      • setAxesBox

        public void setAxesBox(boolean isbox)
        The box can be turned on/off for the current pad.
        Parameters:
        isbox - false is box with axes is off
      • close

        public void close()
        Close the canvas.
      • doc

        public void doc()
        Show online documentation.
      • addBar

        public void addBar(double x,
                           double y,
                           double z,
                           double height,
                           double radius)
        Build a bar as a cylinder in 3D and add to the list of shapes on the current pad. Use "update" method to display it.
        Parameters:
        x - position in X
        y - position in Y
        radius - radius
      • addPoint

        public void addPoint(double x,
                             double y,
                             double z,
                             double width)
        Add a point to the list of shapes on the current pad. Use "update" method to display it.
        Parameters:
        x - position in X
        y - position in Y
        z - position in Z
        width - width or size
      • addPolygon

        public void addPolygon(P2D p2d)
        Add a flat line to the current pad. Use "update" method to display it.
        Parameters:
        p2d - array of X,Y,Z which define polygone points
      • addFlatLine

        public void addFlatLine(float[] x,
                                float[] y,
                                double depth)
        Add a flat line to the current pad. Use "update" method to display it.
        Parameters:
        x - position in X
        y - position in Y
        depth - depth
        color - color color to fill
      • addDisk

        public void addDisk(double x,
                            double y,
                            double z,
                            double radiusInner,
                            double radiusOuter,
                            int slices,
                            int loops)
        Add a sphere to the current canvas. Use "update" to show it.
        Parameters:
        x - position X
        y - position Y
        z - position Z
        slices - number of vertical slices (i.e. wireframes)
        stacks - loops
      • addSphere

        public void addSphere(double x,
                              double y,
                              double z,
                              double radius,
                              double height,
                              int slices,
                              int stacks)
        Add a sphere to the current canvas. Use "update" to show it.
        Parameters:
        x - position X
        y - position Y
        z - position Z
        radius - radius of the sphere
        height - height
        slices - number of vertical slices (i.e. wireframes)
        stacks - number of horizontal stacks (i.e. wireframes)
      • addTube

        public void addTube(double x,
                            double y,
                            double z,
                            double radiusBottom,
                            double radiusTop,
                            double height,
                            int slices,
                            int stacks)
        Add a tube to the current canvas. Use "update" to show it.
        Parameters:
        x - position X
        y - position Y
        z - position Z
        radiusBottom - radius of the bottom circle
        radiusTop - radius of the top circle
        height - height of the cylinder
        slices - number of vertical slices (i.e. wireframes)
        stacks - number of horizontal stacks (i.e. wireframes)
      • addParallelepiped

        public void addParallelepiped(float xmin,
                                      float xmax,
                                      float ymin,
                                      float ymax,
                                      float zmin,
                                      float zmax)
        Add parallelepiped to the current canvas.
        Parameters:
        xmin -
        xmax -
        ymin -
        ymax -
        zmin -
        zmax -
      • addLight

        public void addLight(double x,
                             double y,
                             double z,
                             java.awt.Color AmbiantColor,
                             java.awt.Color DiffuseColor,
                             java.awt.Color SpecularColor)
        Add light to the scene.
        Parameters:
        x - X position
        y - Y position
        z - Z position
        AmbiantColor - Ambiant Color
        DiffuseColor - Diffuse Color
        SpecularColor - Specular Color
      • getShapeList

        public java.util.List<AbstractDrawable> getShapeList()
        Get list of shapes plotted on the current pad given by the cd() method.
        Returns:
        list of plotted shapes.

DMelt 3.0 © DataMelt by jWork.ORG