org.gwoptics.graphics.graph3D
Class SquareGridMesh

java.lang.Object
  extended by org.gwoptics.graphics.Renderable
      extended by org.gwoptics.graphics.graph3D.SquareGridMesh
All Implemented Interfaces:
IRenderable

public class SquareGridMesh
extends Renderable

SquareGridMesh is a square shaped grid with variable resolution along both sides. Each point can have its height set allowing surfaces to be generated. This object is originally designed to work with the SurfaceGraph3D control, but is Usable without this for other purposes.

Each point is coloured according to a supplied IColourmap, solid fill colour or by wireframe. The colour and point positions are both stored in 2 arrays. Default values are a resolution along both sides of 10 squares each 10 units in length.

Important Note: It must be noted that although due to notation the Z axis points upwards, in world space the Y axis points up. Therefore Z <-> Y when it comes to plotting data.

Since:
0.1.1
Author:
Daniel Brown 8/6/09
See Also:
Renderable, IColourmap

Field Summary
 GWColour fillColour
          If no colourmap is provided this is the fill colour for the grid.
 boolean isColoured
          Specifies whether to use a colourmap to colour each vertex
 boolean isFilled
          States whether to fill the grid using fillColour.
 boolean isStroked
          States whether to stroke the grid using strokeColour.
 GWColour strokeColour
          If no colourmap is provided this is the stroke colour for the grid.
 
Fields inherited from class org.gwoptics.graphics.Renderable
position
 
Constructor Summary
SquareGridMesh(int X, int Y, float dx, float dz, processing.core.PApplet parent)
          Allows user to specify dimensions of the grid needed.
 
Method Summary
 void draw()
           
 float getLength()
           
 float getWidth()
           
 float getZValue(int X, int Y)
          Returns height of point at index X and Y.
 void setVertexColour(int X, int Y, GWColour c)
          Sets the colour of a given point at indexes X and Y.
 void setZValue(int X, int Y, float Z)
          This function sets the Z value of a given point at X and Y.
 int sizeX()
          Returns number of squares along X side.
 int sizeY()
          Returns number of squares along Z side.
 
Methods inherited from class org.gwoptics.graphics.Renderable
setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isColoured

public boolean isColoured
Specifies whether to use a colourmap to colour each vertex


strokeColour

public GWColour strokeColour
If no colourmap is provided this is the stroke colour for the grid. Only applies if isColoured is false.


isFilled

public boolean isFilled
States whether to fill the grid using fillColour. Only applies if isColoured is false.


fillColour

public GWColour fillColour
If no colourmap is provided this is the fill colour for the grid. Only applies if isColoured is false.


isStroked

public boolean isStroked
States whether to stroke the grid using strokeColour. Only applies if isColoured is false.

Constructor Detail

SquareGridMesh

public SquareGridMesh(int X,
                      int Y,
                      float dx,
                      float dz,
                      processing.core.PApplet parent)
Allows user to specify dimensions of the grid needed. By default the grid is rendered in wireframe mode with stroke colour as white.

Parameters:
X - number of squares along the x axis
Y - number of squares along the y axis
dx - size of square in x direction
dy - size of square in y direction
parent - PApplet that the grid is rendered in
Method Detail

getWidth

public float getWidth()

getLength

public float getLength()

setZValue

public void setZValue(int X,
                      int Y,
                      float Z)
This function sets the Z value of a given point at X and Y. X and Y both refer to the index of the point.

Parameters:
X -
Y -
Z -

setVertexColour

public void setVertexColour(int X,
                            int Y,
                            GWColour c)
Sets the colour of a given point at indexes X and Y.

Parameters:
X -
Y -
c -

getZValue

public float getZValue(int X,
                       int Y)
Returns height of point at index X and Y.


draw

public void draw()
Specified by:
draw in interface IRenderable
Specified by:
draw in class Renderable

sizeX

public int sizeX()
Returns number of squares along X side.


sizeY

public int sizeY()
Returns number of squares along Z side.



processing library gwoptics by Daniel Brown and Andreas Freise. (c) 2009 onwards