jhplot
Class HPlotXYZ

java.lang.Object
  extended by jhplot.GHPanel
      extended by jhplot.GHFrame
          extended by jhplot.HPlotXYZ
All Implemented Interfaces:
ComponentListener, Serializable, 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 Summary
 org.jzy3d.colors.Color currentFillColor
           
 org.jzy3d.colors.Color currentWiredColor
           
 boolean currentWiredrame
           
 float currentWiredWidth
           
 boolean set
           
 boolean solidColor
           
 
Constructor Summary
HPlotXYZ()
          Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global title "Default"
HPlotXYZ(String title)
          Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global title
HPlotXYZ(String title, int xs, int ys)
          Construct a HView2D canvas with a single plot/graph
HPlotXYZ(String title, int xsize, int ysize, int n1, int n2)
          Create a canvas to display histograms in 3D
HPlotXYZ(String title, int xsize, int ysize, int n1, int n2, boolean set)
          Create a canvas to display histograms in 3D
 
Method Summary
 void add(org.jzy3d.plot3d.primitives.AbstractDrawable shape)
          Add a object to the list
 org.jzy3d.plot3d.primitives.AbstractDrawable add(F2D h1)
          Add a F2D function (a function with 2 arguments, x and y).
 org.jzy3d.plot3d.primitives.AbstractDrawable add(F2D h1, int xsteps, int ysteps)
          Add a F2D function (a function with 2 arguments, x and y).
 void add(H2D h2d)
          Show H2D histogram as bars
 void add(P2D h1)
          Add a container with X,Y.Z values to be shown.
 void add(P2D h1, Color color)
          Add a container with X,Y.Z values to be shown.
 void add(P2D h1, double pointSize)
          Add a container with X,Y.Z values to be shown.
 org.jzy3d.plot3d.primitives.AbstractDrawable add(P2D h1, double penSize, Color color)
          Draw X,Y.Z values in 3D
 void addAsBars(H2D h2d)
          Add a H2D histogram as bars.
 org.jzy3d.plot3d.primitives.AbstractDrawable addAsSurface(H2D h2d)
          Add a H2D histogram.
 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.
 void addContour(org.jzy3d.plot3d.builder.Mapper mapper, org.jzy3d.colors.ColorMapper myColorMapper, org.jzy3d.maths.Range xrange, org.jzy3d.maths.Range yrange)
           
 void addDisk(double x, double y, double z, double radiusInner, double radiusOuter, int slices, int loops)
          Add a sphere to the current canvas.
 void addFlatLine(float[] x, float[] y, double depth)
          Add a flat line to the current pad.
 void addLight(double x, double y, double z, Color AmbiantColor, Color DiffuseColor, Color SpecularColor)
          Add light to the scene.
 void addParallelepiped(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
          Add parallelepiped to the current canvas.
 void addPoint(double x, double y, double z, double width)
          Add a point to the list of shapes on the current pad.
 void addPolygon(P2D p2d)
          Add a flat line to the current pad.
 void addSphere(double x, double y, double z, double radius, double height, int slices, int stacks)
          Add a sphere to the current canvas.
 org.jzy3d.plot3d.primitives.AbstractDrawable addText(String text, double[] pos, Color color)
          Add a text to the canvas.
 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.
 void clear()
          Clear the current graph including graph settings.
 void clear(int i1, int i2)
          Clear the graph characterized by an index in X and Y.
 void clearAll()
          Clear all graphs from data and settings.
 void close()
          Close the canvas.
 void distroy()
          Remove the canvas frame
 void doc()
          Show online documentation.
 void draw(org.jzy3d.plot3d.primitives.AbstractDrawable[] shapes)
          Draw a list of shapes on the current canvas
 void draw(F2D h1, int xsteps, int ysteps)
          Draw a F2D function (a function with 2 arguments, x and y).
 void draw(H2D h2d)
          Draw a H2D histogram.
 void draw(P2D h1, double penSize, Color color)
          Draw X,Y.Z values in 3D using variable colors.
 org.jzy3d.chart.Chart getChart()
          Get the current canvas chart.
 List<org.jzy3d.plot3d.primitives.AbstractDrawable> getShapeList()
          Get list of shapes plotted on the current pad given by the cd() method.
 void quit()
          exit the frame and clear all components
 void setAxesBox(boolean isbox)
          The box can be turned on/off for the current pad.
 void setAxesLabel(int axis, boolean shown)
          Show or not label on axes.
 void setAxesLabelFont(Font font, org.jzy3d.colors.Color color)
          Set font and color for axis labels.
 void setAxisTick(int axis, boolean shown)
          Show or not ticks on axes.
 void setBackground(Color color)
          Set background for the current pad.
 void setColorFill(Color color)
          Set fill color for the current object
 void setColorSolid(boolean solid)
          If you set true, color will be solid and no colorfull color map is used.
 void setColorWireframe(Color color)
          Set fill color for the current object
 void setDistance(double distance)
          Set distance to the object
 void setFaceDisplayed(boolean face)
          Set face shown or not
 void setGridColor(Color color)
          Set Grid color to the current pad
 void setLegendBar(org.jzy3d.plot3d.primitives.AbstractDrawable surface)
          Set a legend to a given surface
 void setNameX(String a)
          Set a name for X axis
 void setNameY(String a)
          Set a name for Y axis
 void setNameZ(String a)
          Set a name for Z axis
 void setRange(double minX, double maxX, double minY, double maxY, double minZ, double maxZ)
          Sets the range for the current plot
 void setRotationAngle(double angle)
          Get the rotation angle
 void setScaling(double scale)
          Set the scaling
 void setTickRenderer(int axis, int dig)
          Set scientific notation with a give number of digits
 void setTickRendererAll(int dig)
          Set scientific notation with a give number of digits for all ticks
 void setViewPoint(double x, double y, double z)
          Set view point
 void setWireframe(boolean wiredrame)
          Set wireframe mode for the current object.
 void setWireframeWidth(double width)
          Set width of the line for wireframe
 void update()
          Update current pad.
 void update(int n1, int n2)
          Refresh only a particular pad.
 void updateAll()
          Refresh all the plots on the same canvas.
 void visible()
          Show the canvas
 void visible(boolean vs)
          Set the canvas frame visible or not
 
Methods inherited from class jhplot.GHFrame
addGraph, cd, componentHidden, componentMoved, componentShown, getCdX, getCdY, getFrame, getHTMLUrl, getNtotX, getNtotY, setPlotsNum, updateFrame
 
Methods inherited from class jhplot.GHPanel
addComp, componentResized, disableDoubleBuffering, enableDoubleBuffering, export, exportDialog, exportImage, getCanvasPanel, getMarginBackground, getMarginPanelBottom, getMarginPanelCenter, getMarginPanelLeft, getMarginPanelRight, getMarginPanelTop, getMarginSizeBottom, getMarginSizeLeft, getMarginSizeRight, getMarginSizeTop, getSizeX, getSizeY, getTextBottom, getTextBottomColor, getTextBottomColorBack, getTextBottomFont, getTextLeft, getTextLeftColor, getTextLeftColorBack, getTextLeftFont, getTextPosBottomX, getTextPosBottomY, getTextPosLeftX, getTextPosLeftY, getTextPosRightX, getTextPosRightY, getTextPosTopX, getTextPosTopY, getTextRight, getTextRightColor, getTextRightColorBack, getTextRightFont, getTextRotationBottom, getTextRotationLeft, getTextRotationRight, getTextRotationTop, getTextTop, getTextTopColor, getTextTopColorBack, getTextTopFont, isBorderShown, printGraph, resetMargins, setGTitle, setGTitle, setGTitle, setGTitle, setGTitle, setMarginBackground, setMarginSizeBottom, setMarginSizeLeft, setMarginSizeRight, setMarginSizeTop, setSizePanel, setTextBottom, setTextBottom, setTextBottom, setTextBottom, setTextBottomColorBack, setTextLeft, setTextLeft, setTextLeft, setTextLeft, setTextLeftColorBack, setTextPosBottomX, setTextPosBottomY, setTextPosLeftX, setTextPosLeftY, setTextPosRightX, setTextPosRightY, setTextPosTopX, setTextPosTopY, setTextRight, setTextRight, setTextRight, setTextRight, setTextRightColorBack, setTextRotationBottom, setTextRotationLeft, setTextRotationRight, setTextRotationTop, setTextTop, setTextTop, setTextTop, setTextTopColorBack, showBorders
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

set

public boolean set

currentWiredrame

public boolean currentWiredrame

currentFillColor

public org.jzy3d.colors.Color currentFillColor

currentWiredColor

public org.jzy3d.colors.Color currentWiredColor

currentWiredWidth

public float currentWiredWidth

solidColor

public boolean solidColor
Constructor Detail

HPlotXYZ

public HPlotXYZ(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(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(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(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

setDistance

public void setDistance(double distance)
Set distance to the object

Parameters:
distance - distance

setColorFill

public void setColorFill(Color color)
Set fill color for the current object

Parameters:
color - to fill object

setColorWireframe

public void setColorWireframe(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

setScaling

public void setScaling(double scale)
Set the scaling

Parameters:
scale -

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(Color color)
Set Grid color to the current pad

Parameters:
color - grid color

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(String a)
Set a name for X axis

Parameters:
a - Name of the label for X axis

setNameY

public void setNameY(String a)
Set a name for Y axis

Parameters:
a - Name of the label for Y axis

setNameZ

public void setNameZ(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(Font font,
                             org.jzy3d.colors.Color color)
Set font and color for axis labels.

Parameters:
font -
color -

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 void add(P2D h1,
                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 void 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 void draw(P2D h1,
                 double penSize,
                 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 org.jzy3d.plot3d.primitives.AbstractDrawable add(P2D h1,
                                                        double penSize,
                                                        Color color)
Draw X,Y.Z values in 3D

Parameters:
h1 - input data
penSize - size of the points
color - to show points
return - what was added.

add

public void add(org.jzy3d.plot3d.primitives.AbstractDrawable shape)
Add a object to the list

Parameters:
shape -

draw

public void draw(org.jzy3d.plot3d.primitives.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.


addText

public org.jzy3d.plot3d.primitives.AbstractDrawable addText(String text,
                                                            double[] pos,
                                                            Color color)
Add a text to the canvas.

Parameters:
text - text
pos - position (x,y,z)
color - color
Returns:
return what is added

add

public org.jzy3d.plot3d.primitives.AbstractDrawable add(F2D h1)
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:
h1 - input function for drawing.
return - surface which was just added.

add

public org.jzy3d.plot3d.primitives.AbstractDrawable add(F2D h1,
                                                        int xsteps,
                                                        int ysteps)
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 - input function for drawing.
xsteps - - steps in X (50 is optimal)
ysteps - - steps in Y (50 is optimal)
return - what was added.

draw

public void draw(F2D h1,
                 int xsteps,
                 int ysteps)
Draw 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 - input function for drawing.
xsteps - - steps in X (50 is optimal)
ysteps - - steps in Y (50 is optimal)

addContour

public void addContour(org.jzy3d.plot3d.builder.Mapper mapper,
                       org.jzy3d.colors.ColorMapper myColorMapper,
                       org.jzy3d.maths.Range xrange,
                       org.jzy3d.maths.Range yrange)

addAsSurface

public org.jzy3d.plot3d.primitives.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
reurn - what was added

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.
return - what was added

setLegendBar

public void setLegendBar(org.jzy3d.plot3d.primitives.AbstractDrawable surface)
Set a legend to a given surface

Parameters:
surface - input object

draw

public void 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 org.jzy3d.chart.Chart getChart()
Get the current canvas chart.

Returns:

setBackground

public void setBackground(Color color)
Set background for the current pad.

Parameters:
color -

setTickRenderer

public void setTickRenderer(int axis,
                            int dig)
Set scientific notation with a give number of digits

Parameters:
axis - axis. 0=X, 1=Y, 2=Z
dig - number of digits

setTickRendererAll

public void setTickRendererAll(int dig)
Set scientific notation with a give 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,
                     Color AmbiantColor,
                     Color DiffuseColor,
                     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 List<org.jzy3d.plot3d.primitives.AbstractDrawable> getShapeList()
Get list of shapes plotted on the current pad given by the cd() method.

Returns:
list of plotted shapes.


jHepWork 3.2 ©