Class HilbertGen
PixelMapGen for instance variables shared by all child classes.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHilbertGen(int depth) HilbertGen(int width, int height) HilbertGen(int width, int height, AffineTransformType type) HilbertGen(int depth, AffineTransformType type) -
Method Summary
Modifier and TypeMethodDescriptionprivate int[]d2xy(int n, int pos) describe()int[]generate()Initialization method that setsthis.coords, and thenthis.pixelMapandthis.sampleMap:this.coordsis a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once.private ArrayList<int[]>private ArrayList<int[]>generateHilbertCoordinates(int n) static MultiGenhilbertLoop3x2(int genW, int genH) Generates a looping fractal signal path consisting of 6 HilbertGens, arranged 3 wide and 2 tall, to fit a 3 * genW by 2 * genH image.static MultiGenhilbertMultigenLoop(int columns, int rows, int genEdge) static MultiGenhilbertVerticalStackBou(int stacks, int rows, int units, int genW, int genH) This method creates a vertical stacks of rows of HilbertGens.static MultiGenhilbertVerticalStackOrtho(int stacks, int rows, int units, int genW, int genH) This method creates a vertical stacks of rows of HilbertGens.static booleanprevalidate(int width, int height) booleanvalidate(int width, int height) Methods inherited from class net.paulhertz.pixelaudio.PixelMapGen
findNearestPowerOfTwoLessThan, findPowerOfTwo, getCoordinates, getCoordinatesCopy, getHeight, getInversMapFromPixelArray, getPixelMap, getPixelMapCopy, getPixelMapFromCoordinates, getSampleMap, getSampleMapCopy, getSize, getTransformType, getWidth, isPowerOfTwo, loadIndexMaps, randomTransform, setMapsFromCoords, setTransformType, transformCoords
-
Field Details
-
depth
public int depthrecursion depth -
doXYSwap
private boolean doXYSwap -
description
- See Also:
-
-
Constructor Details
-
HilbertGen
-
HilbertGen
public HilbertGen(int width, int height) -
HilbertGen
public HilbertGen(int depth) -
HilbertGen
-
-
Method Details
-
describe
- Specified by:
describein classPixelMapGen- Returns:
- A String describing the mapping generated by your class and any initialization requirements.
-
validate
public boolean validate(int width, int height) - Specified by:
validatein classPixelMapGen- Returns:
- true if the width and height parameters are valid for creating a mapping with this generator, otherwise, false.
-
prevalidate
public static boolean prevalidate(int width, int height) -
generate
public int[] generate()Description copied from class:PixelMapGenInitialization method that sets
this.coords, and thenthis.pixelMapandthis.sampleMap:this.coordsis a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once. Once you have created it, you can callsetMapsFromCoords()to setthis.pixelMapandthis.sampleMapautomatically.generate()must be called from your class, so that you can initialize any local variables before generating coordinates and LUTs. The best place to call it is typically on the last line of the constructor for your class, after calling super() on the first line and after initializing any local variables needed to generate your coordinates and LUTs. You must initializethis.coords,this.pixelMap, andthis.sampleMapwithin generate(). SeeDiagonalZigzagGenorHilbertGenfor sample code.- Specified by:
generatein classPixelMapGen- Returns:
- this.pixelMap, the value for PixelAudioMapper.signalToImageLUT.
-
generateCoordinates
-
generateHilbertCoordinates
- Parameters:
n- size of the array of Hilbert curve coordinates, necessarily a power of 4- Returns:
- an ArrayList of integer pairs {x,y} representing the coordinates of a Hilbert curve
-
d2xy
private int[] d2xy(int n, int pos) -
hilbertMultigenLoop
- Parameters:
columns- number of columns of gens widerows- number of rows of gens highgenEdge- number of pixels for the edge of each Hilbert curve, must be a power of 2- Returns:
- a MultiGen consisting of rows rows and cols columns of Hilbert curves check for null return value
-
hilbertLoop3x2
Generates a looping fractal signal path consisting of 6 HilbertGens, arranged 3 wide and 2 tall, to fit a 3 * genW by 2 * genH image. This particular MultiGen configuration was used so extensively in my sample code that I've given it its own method. Note that genH must equal genW and both must be powers of 2. For the image size we're using in this example, genW = image width / 3 and genH = image height / 2.- Parameters:
genW- width of each HilbertGengenH- height of each HilbertGen- Returns:
- a Multigen composed of 6 HilbertGens on a 3 x 2 grid
-
hilbertVerticalStackOrtho
public static MultiGen hilbertVerticalStackOrtho(int stacks, int rows, int units, int genW, int genH) This method creates a vertical stacks of rows of HilbertGens. Each row begins genH pixels down from the previous row, back at the beginning of the previous row (i.e., in "row major" order, like a bitmap). This method pairs nicely with an image with 3 columns of with 8 rows of words, using the image as a control surface for sampling an audio file with words recorded at the appropriate locations to match the screen order. I used it for a performance work, DeadBodyWorkFlow, which is included in the The signal path jumps from the end of the last gen in each row to the beginning of the first gen int he next row. The path in each row is continuous, which provides some interesting optical effects.- Parameters:
stacks- the number of stacksrows- the number of rows in each stackunits- the number of gens in each rowgenW- the width of each gen, a power of 2genH- the height of each gen, equal to genW- Returns:
- a Multigen consisting of stacks * rows * units PixelMapGens
-
hilbertVerticalStackBou
This method creates a vertical stacks of rows of HilbertGens. Each row begins genH pixels down from the previous row. Alternating rows add units in opposite directions. This means path continuity is possible in each stack by changing the orientation of the gens; however, it isn't fully implemented in this example. Hint: choosing the right orientation for each gen will assure path continuity.- Parameters:
stacks- the number of stacksrows- the number of rows in each stackunits- the number of gens in each rowgenW- the width of each gen, a power of 2genH- the height of each gen, equal to genW- Returns:
- a Multigen consisting of stacks * rows * units PixelMapGens
-