Package com.ardor3d.math.functions
Class GridPatternFunction3D
java.lang.Object
com.ardor3d.math.functions.GridPatternFunction3D
- All Implemented Interfaces:
Function3D
- Direct Known Subclasses:
BrickGridFunction3D
,HexGridFunction3D
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
ConstructorDescriptionGridPatternFunction3D
(double[][] grid) Create the grid pattern function.GridPatternFunction3D
(double[][] grid, double xScaleFactor, double yScaleFactor) Create the grid pattern function. -
Method Summary
Modifier and TypeMethodDescriptiondouble
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.
-
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 interfaceFunction3D
- Parameters:
x
- the 1st value in our tupley
- the 2nd value in our tuplez
- 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 gridgridY
- the ordinate on the gridscaledX
- the x scale valuescaledY
- the y scale value- Returns:
- the value from the user-defined grid
-