Class GridPatternFunction3D

java.lang.Object
com.ardor3d.math.functions.GridPatternFunction3D
All Implemented Interfaces:
Function3D
Direct Known Subclasses:
BrickGridFunction3D, HexGridFunction3D

public class GridPatternFunction3D extends Object implements Function3D
Creates a pattern in the XY plane that is defined by a user-provided grid of values. This is not really 3D, since it ignores the z factor.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GridPatternFunction3D(double[][] grid)
    Create the grid pattern function.
    GridPatternFunction3D(double[][] grid, double xScaleFactor, double yScaleFactor)
    Create the grid pattern function.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    eval(double x, double y, double z)
    Evaluate the x and y values (ignores z) to determine the value to return.
    protected double
    getCellValue(int gridX, int gridY, double scaledX, double scaledY)
    Gets a value from the user-defined grid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GridPatternFunction3D

      public GridPatternFunction3D(double[][] grid)
      Create the grid pattern function. The x-scale and y-scale will both default to 1.0.
      Parameters:
      grid - A grid of values in the range of -1 to 1.
    • GridPatternFunction3D

      public GridPatternFunction3D(double[][] grid, double xScaleFactor, double yScaleFactor)
      Create the grid pattern function.
      Parameters:
      grid - A grid of values in the range of -1 to 1.
      xScaleFactor - The amount by which to scale grid cells along their x axis.
      yScaleFactor - The amount by which to scale grid cells along their y axis.
  • Method Details

    • eval

      public double eval(double x, double y, double z)
      Evaluate the x and y values (ignores z) to determine the value to return.
      Specified by:
      eval in interface Function3D
      Parameters:
      x - the 1st value in our tuple
      y - the 2nd value in our tuple
      z - the 3rd value in our tuple
      Returns:
      some value, generally (but not necessarily) in [-1, 1]
    • getCellValue

      protected double getCellValue(int gridX, int gridY, double scaledX, double scaledY)
      Gets a value from the user-defined grid. This is an extension point for subclasses which may need to perform a calculation of some type on that value before returning it. The default implementation simply returns the value from the grid at gridX/gridY.
      Parameters:
      gridX - the abscissa on the grid
      gridY - the ordinate on the grid
      scaledX - the x scale value
      scaledY - the y scale value
      Returns:
      the value from the user-defined grid