net.jbeans.j3d.data
Class LookupTable

java.lang.Object
  extended bynet.jbeans.j3d.data.AttributeArray
      extended bynet.jbeans.j3d.data.LookupTable
Direct Known Subclasses:
DefaultColorLookupTable

public abstract class LookupTable
extends AttributeArray

LookupTable is an object that map scalar values into other scalar or vector values. This class is designed as a base class for derivation by other classes. The build() methods are abstract method and may require overloading in subclasses.

Version:
$Revision: 1.3 $
Author:
Masahiro Takatsuka (masa@jbeans.net)
See Also:
AttributeArray

Field Summary
protected  net.jbeans.util.time.TimeStamp buildTime
           
protected  net.jbeans.util.time.TimeStamp insertTime
           
protected  int numberOfLookups
           
 
Fields inherited from class net.jbeans.j3d.data.AttributeArray
data
 
Constructor Summary
LookupTable(int dataType, int dim)
           
LookupTable(int dataType, int dim, int size)
          Construct with range=(0,1); and hsv ranges set up for rainbow color table (from red to blue).
 
Method Summary
protected abstract  void build()
          Generate lookup table.
 int getNumberOfLookups()
           
 double[] getTableRange()
           
 double[] getTableValue(int id)
          Return a value for the given index into the lookup table.
 void getTableValue(int id, double[] value)
          Return a rgba color value for the given index into the lookup table.
 double[] mapValue(double v)
          Map one value through the lookup table.
 void mapValues(java.lang.Object input, double[] output, int numberOfValues, int inputIncrement)
          map a set of scalars through the lookup table
 void setNumberOfLookups(int number)
          Set the number of colors in the lookup table.
 void setNumberOfTableValues(int number)
          Specify the number of values (i.e., colors) in the lookup table.
 void setTableRange(double[] r)
          Set/Get the minimum/maximum scalar values for scalar mapping.
 void setTableRange(double min, double max)
           
 void setTableValue(int indx, double[] value)
          Directly load values into lookup table.
 
Methods inherited from class net.jbeans.j3d.data.AttributeArray
allocate, copy, getData, getDataType, getDimension, initialize, makeObject, reset, setData, setDataType, setDataTypeToBit, setDataTypeToChar, setDataTypeToDouble, setDataTypeToFloat, setDataTypeToInt, setDataTypeToLong, setDataTypeToShort, setDataTypeToString, squeeze
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

insertTime

protected net.jbeans.util.time.TimeStamp insertTime

buildTime

protected net.jbeans.util.time.TimeStamp buildTime

numberOfLookups

protected int numberOfLookups
Constructor Detail

LookupTable

public LookupTable(int dataType,
                   int dim,
                   int size)
Construct with range=(0,1); and hsv ranges set up for rainbow color table (from red to blue).


LookupTable

public LookupTable(int dataType,
                   int dim)
Method Detail

build

protected abstract void build()
Generate lookup table.


setNumberOfLookups

public void setNumberOfLookups(int number)
Set the number of colors in the lookup table. Use this method before building the lookup table. Use SetNumberOfTableValues() to change the table size after the lookup table has been built.


getNumberOfLookups

public int getNumberOfLookups()

setTableRange

public void setTableRange(double[] r)
                   throws InvalidDataRangeException
Set/Get the minimum/maximum scalar values for scalar mapping. Scalar values less than minimum range value are clamped to minimum range value. Scalar values greater than maximum range value are clamped to maximum range value.

Throws:
InvalidDataRangeException

setTableRange

public void setTableRange(double min,
                          double max)
                   throws InvalidDataRangeException
Throws:
InvalidDataRangeException

getTableRange

public double[] getTableRange()

mapValue

public double[] mapValue(double v)
Map one value through the lookup table. It returns an array of double containing corresponding mapped value.


mapValues

public void mapValues(java.lang.Object input,
                      double[] output,
                      int numberOfValues,
                      int inputIncrement)
map a set of scalars through the lookup table

Parameters:
input - an array of primitives (type, char, short, int, long, flost, double).

setNumberOfTableValues

public void setNumberOfTableValues(int number)
Specify the number of values (i.e., colors) in the lookup table. This method simply allocates memory and prepares the table for use with SetTableValue(). It differs from Build() method in that the allocated memory is not initialized according to HSVA ramps.


setTableValue

public void setTableValue(int indx,
                          double[] value)
Directly load values into lookup table. Use double values for elements. Make sure that you've either used the build() method or used setNumberOfTableValues() prior to using this method.


getTableValue

public double[] getTableValue(int id)
Return a value for the given index into the lookup table. Values are expressed as double values.


getTableValue

public void getTableValue(int id,
                          double[] value)
Return a rgba color value for the given index into the lookup table. Color components are expressed as [0,1] float values.



Copyright © 1995-2004 net.jbeans. All Rights Reserved.