org.jzy3d.plot3d.primitives.axes
Class AxeBox

java.lang.Object
  extended by org.jzy3d.plot3d.primitives.axes.AxeBox
All Implemented Interfaces:
IAxe
Direct Known Subclasses:
ContourAxeBox, FeedbackBufferAxeBox

public class AxeBox
extends Object
implements IAxe

The AxeBox displays a box with front face invisible and ticks labels.

Author:
Martin Pernollet

Field Summary
protected static int AXE_X
           
protected static int AXE_Y
           
protected static int AXE_Z
           
protected  int[][] axeXquads
           
protected  float[][] axeXx
           
protected  float[][] axeXy
           
protected  float[][] axeXz
           
protected  int[][] axeYquads
           
protected  float[][] axeYx
           
protected  float[][] axeYy
           
protected  float[][] axeYz
           
protected  int[][] axeZquads
           
protected  float[][] axeZx
           
protected  float[][] axeZy
           
protected  float[][] axeZz
           
protected  BoundingBox3d boxBounds
           
protected  Coord3d center
           
protected  IAxeLayout layout
           
protected  float[] normx
           
protected  float[] normy
           
protected  float[] normz
           
protected static int PRECISION
           
protected  boolean[] quadIsHidden
           
protected  float[][] quadx
           
protected  float[][] quady
           
protected  float[][] quadz
           
protected  Coord3d scale
           
protected  ITextRenderer txt
           
protected  TextOverlay txtRenderer
           
protected  View view
           
protected  BoundingBox3d wholeBounds
           
protected  float xrange
           
protected  float yrange
           
protected  float zrange
           
 
Constructor Summary
AxeBox(BoundingBox3d bbox)
           
AxeBox(BoundingBox3d bbox, IAxeLayout layout)
           
 
Method Summary
 void dispose()
           
 void draw(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera camera)
          Draws the AxeBox.
protected  void drawCube(javax.media.opengl.GL2 gl, int mode)
          Make all GL2 calls allowing to build a cube with 6 separate quads.
protected  void drawGridOnQuad(javax.media.opengl.GL2 gl, int quad)
          Draw a grid on the desired quad.
protected  BoundingBox3d drawTicks(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera cam, int axis, int direction, Color color)
           
protected  BoundingBox3d drawTicks(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera cam, int axis, int direction, Color color, Halign hal, Valign val)
           
protected  int findClosestXaxe(Camera cam)
          Selects the closest displayable X axe from camera
protected  int findClosestYaxe(Camera cam)
          Selects the closest displayable Y axe from camera
protected  int findClosestZaxe(Camera cam)
          Selects the closest displayable Z axe from camera
 BoundingBox3d getBoxBounds()
           
 Coord3d getCenter()
           
 TextOverlay getExperimentalTextRenderer()
           
protected  boolean[] getHiddenQuads(javax.media.opengl.GL gl, Camera cam)
          Computes the visibility of each cube face.
 IAxeLayout getLayout()
           
 ITextRenderer getTextRenderer()
           
 View getView()
           
 BoundingBox3d getWholeBounds()
          Return the boundingBox of this axis, including the volume occupied by the texts.
protected  void init()
           
protected  int min(double[] values)
          Return the index of the minimum value contained in the input array of doubles.
protected  int print3DcolorVertex(int size, int count, float[] buffer)
          Print out parameters of a gl call in 3dColor mode.
protected  void printHiddenQuads()
          Print out display status of quads.
 void setAxe(BoundingBox3d bbox)
           
protected  void setAxeBox(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
          Set the parameters and data of the AxeBox.
 void setExperimentalTextOverlayRenderer(ICanvas canvas)
          Initialize a text renderer that will reference the target canvas for getting its dimensions (in order to convert coordinates from OpenGL2 to Java2d).
 void setScale(Coord3d scale)
          Set the scaling factor that are applyed on this object before GL2 commands.
 void setTextRenderer(ITextRenderer renderer)
           
 void setView(View view)
          When setting a current view, the AxeBox can know the view is on mode CameraMode.TOP, and optimize some axis placement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRECISION

protected static final int PRECISION
See Also:
Constant Field Values

view

protected View view

txt

protected ITextRenderer txt

txtRenderer

protected TextOverlay txtRenderer

layout

protected IAxeLayout layout

boxBounds

protected BoundingBox3d boxBounds

wholeBounds

protected BoundingBox3d wholeBounds

center

protected Coord3d center

scale

protected Coord3d scale

xrange

protected float xrange

yrange

protected float yrange

zrange

protected float zrange

quadx

protected float[][] quadx

quady

protected float[][] quady

quadz

protected float[][] quadz

normx

protected float[] normx

normy

protected float[] normy

normz

protected float[] normz

axeXx

protected float[][] axeXx

axeXy

protected float[][] axeXy

axeXz

protected float[][] axeXz

axeYx

protected float[][] axeYx

axeYy

protected float[][] axeYy

axeYz

protected float[][] axeYz

axeZx

protected float[][] axeZx

axeZy

protected float[][] axeZy

axeZz

protected float[][] axeZz

axeXquads

protected int[][] axeXquads

axeYquads

protected int[][] axeYquads

axeZquads

protected int[][] axeZquads

quadIsHidden

protected boolean[] quadIsHidden

AXE_X

protected static final int AXE_X
See Also:
Constant Field Values

AXE_Y

protected static final int AXE_Y
See Also:
Constant Field Values

AXE_Z

protected static final int AXE_Z
See Also:
Constant Field Values
Constructor Detail

AxeBox

public AxeBox(BoundingBox3d bbox)

AxeBox

public AxeBox(BoundingBox3d bbox,
              IAxeLayout layout)
Method Detail

init

protected void init()

dispose

public void dispose()
Specified by:
dispose in interface IAxe

getTextRenderer

public ITextRenderer getTextRenderer()

setTextRenderer

public void setTextRenderer(ITextRenderer renderer)

getExperimentalTextRenderer

public TextOverlay getExperimentalTextRenderer()

setExperimentalTextOverlayRenderer

public void setExperimentalTextOverlayRenderer(ICanvas canvas)
Initialize a text renderer that will reference the target canvas for getting its dimensions (in order to convert coordinates from OpenGL2 to Java2d).

Parameters:
canvas -

getView

public View getView()

setView

public void setView(View view)
When setting a current view, the AxeBox can know the view is on mode CameraMode.TOP, and optimize some axis placement.


setAxe

public void setAxe(BoundingBox3d bbox)
Specified by:
setAxe in interface IAxe

getBoxBounds

public BoundingBox3d getBoxBounds()
Specified by:
getBoxBounds in interface IAxe

getLayout

public IAxeLayout getLayout()
Specified by:
getLayout in interface IAxe

getWholeBounds

public BoundingBox3d getWholeBounds()
Return the boundingBox of this axis, including the volume occupied by the texts. This requires calling draw() before, which computes actual ticks position in 3d, and updates the bounds.


getCenter

public Coord3d getCenter()
Specified by:
getCenter in interface IAxe

setScale

public void setScale(Coord3d scale)
Set the scaling factor that are applyed on this object before GL2 commands.

Specified by:
setScale in interface IAxe

draw

public void draw(javax.media.opengl.GL2 gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera camera)
Draws the AxeBox. The camera is used to determine which axis is closest to the ur point ov view, in order to decide for an axis on which to diplay the tick values.

Specified by:
draw in interface IAxe

setAxeBox

protected void setAxeBox(float xmin,
                         float xmax,
                         float ymin,
                         float ymax,
                         float zmin,
                         float zmax)
Set the parameters and data of the AxeBox.


drawCube

protected void drawCube(javax.media.opengl.GL2 gl,
                        int mode)
Make all GL2 calls allowing to build a cube with 6 separate quads. Each quad is indexed from 0.0f to 5.0f using glPassThrough, and may be traced in feedback mode when mode=GL2.GL_FEEDBACK


drawGridOnQuad

protected void drawGridOnQuad(javax.media.opengl.GL2 gl,
                              int quad)
Draw a grid on the desired quad.


drawTicks

protected BoundingBox3d drawTicks(javax.media.opengl.GL2 gl,
                                  javax.media.opengl.glu.GLU glu,
                                  Camera cam,
                                  int axis,
                                  int direction,
                                  Color color)

drawTicks

protected BoundingBox3d drawTicks(javax.media.opengl.GL2 gl,
                                  javax.media.opengl.glu.GLU glu,
                                  Camera cam,
                                  int axis,
                                  int direction,
                                  Color color,
                                  Halign hal,
                                  Valign val)

findClosestXaxe

protected int findClosestXaxe(Camera cam)
Selects the closest displayable X axe from camera


findClosestYaxe

protected int findClosestYaxe(Camera cam)
Selects the closest displayable Y axe from camera


findClosestZaxe

protected int findClosestZaxe(Camera cam)
Selects the closest displayable Z axe from camera


min

protected int min(double[] values)
Return the index of the minimum value contained in the input array of doubles. If no value is smaller than Double.MAX_VALUE, the returned index is -1.


getHiddenQuads

protected boolean[] getHiddenQuads(javax.media.opengl.GL gl,
                                   Camera cam)
Computes the visibility of each cube face.


print3DcolorVertex

protected int print3DcolorVertex(int size,
                                 int count,
                                 float[] buffer)
Print out parameters of a gl call in 3dColor mode.


printHiddenQuads

protected void printHiddenQuads()
Print out display status of quads.