artofillusion.math
Class Cells

java.lang.Object
  extended by artofillusion.math.Cells

public class Cells
extends java.lang.Object

This class provides an implementation of Steven Worley's cellular texture basis function as described in

Worley, S. "A Cellular Texture Basis Function." Siggraph Proceedings, pp. 291-294, 1996.

This function scatters "feature points" at random locations throughout 3D space. At any point (x, y, z), it defines the function f1(x, y, z) to be the distance to the nearest feature point. It similarly defines f2(x, y, z) as the distance to the second nearest feature point, and similarly for f3(x, y, z), etc.


Field Summary
static int CHESS_BOARD
           
static int CITY_BLOCK
           
static int EUCLIDEAN
           
 
Constructor Summary
Cells()
           
 
Method Summary
 void calcFunctions(Vec3 p, double[] value, Vec3[] grad, int[] id)
          Calculate the various functions at a specified point.
 int getMetric()
          Get which distance metric is being used.
 void setMetric(int metric)
          Set which distance metric to use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EUCLIDEAN

public static final int EUCLIDEAN
See Also:
Constant Field Values

CITY_BLOCK

public static final int CITY_BLOCK
See Also:
Constant Field Values

CHESS_BOARD

public static final int CHESS_BOARD
See Also:
Constant Field Values
Constructor Detail

Cells

public Cells()
Method Detail

getMetric

public int getMetric()
Get which distance metric is being used. Allowed values are EUCLIDEAN, CITY_BLOCK, or CHESS_BOARD.


setMetric

public void setMetric(int metric)
Set which distance metric to use. Allowed values are EUCLIDEAN, CITY_BLOCK, or CHESS_BOARD.


calcFunctions

public void calcFunctions(Vec3 p,
                          double[] value,
                          Vec3[] grad,
                          int[] id)
Calculate the various functions at a specified point. The number of functions to evaluate is determined by the length of value[]. The values of the functions are returned in value[], and their gradients in grad[]. A "unique identifier" for the nearest, second nearest, etc. feature point is returned in id. If gradients are not needed, null may be passed for grad[].



Copyright © 1999-2011 by Peter Eastman.