org.gwoptics.graphics.graph3D
Class SurfaceTrace3D

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

public class SurfaceTrace3D
extends Renderable

This class encapsulates a surface trace on a graph. It handles processing each point on the grid as well as colouring it it also handles relating graph space to world space(see below). This object is designed to work with the SurfaceGraph3D closely, or anything that uses Axis3D objects in a Cartesian form.

Firstly world space is the size of everything render in the sketch, so if we specify something has a length 100 its a 100 units long and at whatever position we set it at in units. Graph space on the other hand relates to the fact we can have axis ranges, for example -10 to 10, which is displayed along out axis which has a world length of 100. therefore 0 in graph space relates to 50 units along the axis in world space.

Since:
0.2.2
Author:
Daniel Brown 16/6/09
See Also:
SquareGridMesh, IColourmap

Field Summary
 java.lang.String name
           
 
Fields inherited from class org.gwoptics.graphics.Renderable
position
 
Constructor Summary
SurfaceTrace3D(processing.core.PApplet parent, Axis3D x, Axis3D y, Axis3D z, int Xresolution, int Yresolution, IGraph3DCallback cb, java.lang.String n, IColourmap map)
          To generate a surface trace all 3 cartesian axis that the trace is mapped onto need to be supplied, also the resolution of the grid in both X and Y directions.
 
Method Summary
 void calculateSpacing()
          This function must be called when an axis changes its range as the graph to world space constants will change.
 void draw()
          Draws the surface trace
 void generateSurface()
          This function calls the callback object set during the constructor, and applies the equation is represents to each of the points, relating graph space to world space for correctly position traces.
 float[] getLowestPoint()
           
 float[] getMaximumPoint()
           
 float getZValue(int X, int Y)
           
 void setAutoRangeZAxis(boolean value)
           
 void setCallback(IGraph3DCallback cb)
           
 void setIsSurfacedStroked(boolean b)
           
 void setIsSurfaceFilled(boolean b)
           
 void setSurfaceFill(GWColour c)
           
 void setSurfaceStroke(GWColour c)
           
 
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

name

public java.lang.String name
Constructor Detail

SurfaceTrace3D

public SurfaceTrace3D(processing.core.PApplet parent,
                      Axis3D x,
                      Axis3D y,
                      Axis3D z,
                      int Xresolution,
                      int Yresolution,
                      IGraph3DCallback cb,
                      java.lang.String n,
                      IColourmap map)
To generate a surface trace all 3 cartesian axis that the trace is mapped onto need to be supplied, also the resolution of the grid in both X and Y directions. A callback must be specified or a NullReferenceException will be throw, the colourmap object on the other hand is nullable.

Parameters:
parent - PApplet that will render this object
x - Reference to X Axis
y - Reference to Y Axis
z - Reference to Z Axis
Xresolution - Number of squares in X direction
Yresolution - Number of squares in Z direction
cb - Callback object which defines the equation of the surface
n - Name of the trace
map - Colourmap used to colour surface. Can be null for for wireframe.
Method Detail

setCallback

public void setCallback(IGraph3DCallback cb)

setIsSurfacedStroked

public void setIsSurfacedStroked(boolean b)

setSurfaceStroke

public void setSurfaceStroke(GWColour c)

setIsSurfaceFilled

public void setIsSurfaceFilled(boolean b)

setSurfaceFill

public void setSurfaceFill(GWColour c)

setAutoRangeZAxis

public void setAutoRangeZAxis(boolean value)

getZValue

public float getZValue(int X,
                       int Y)

getMaximumPoint

public float[] getMaximumPoint()

getLowestPoint

public float[] getLowestPoint()

calculateSpacing

public void calculateSpacing()
This function must be called when an axis changes its range as the graph to world space constants will change.


generateSurface

public void generateSurface()
This function calls the callback object set during the constructor, and applies the equation is represents to each of the points, relating graph space to world space for correctly position traces.


draw

public void draw()
Draws the surface trace

Specified by:
draw in interface IRenderable
Specified by:
draw in class Renderable


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