Package net.paulhertz.pixelaudio
Class ArgosyArray
java.lang.Object
net.paulhertz.pixelaudio.ArgosyArray
- Author:
- ignot
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionArgosyArray
(int bigSize, int unitSize, int reps, boolean isCentered) ArgosyArray
(int bigSize, int unitSize, int reps, boolean isCentered, int[] colors, int gapColor, float gapScale, int[] argosy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Fill the big array with the argosy pattern, called by bigArrayFill.int[]
argosyGen
(int depth, int v1, int v2, boolean verbose) Generates an argosy pattern based on a Fibonacci tree.void
Sets up the big array and fills it with colors using the argosy pattern.fibo
(int depth, boolean verbose) An L-System generator for Fibonacci trees represented as a sequence of 0s and 1s.int
int[]
int
int
float
int
int[]
int
int
int[]
int[]
int
void
rotateLeft
(int d) Rotates bigArray left by d values.void
setAnimStep
(int animStep) Set the animStep, with no side effects (but animation calls will use the new value)void
setArgosyColors
(int[] argosyColors) Sets new argosyColors and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
setArgosyGap
(int argosyGap) Sets argosyGap and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
setArgosyGapColor
(int argosyGapColor) Sets argosyGapColor and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
setArgosyGapScale
(float argosyGapScale) Sets argosyGapScale and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
setArgosyPattern
(int[] argosyPattern) Sets a new argosy pattern and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
setBigArray
(int[] bigArray) void
setNewColors
(int[] argosyColors, int argosyGapColor) Sets new argosy colors and argosy gap color, triggers a call to bigArrayFill().void
setUnitSize
(int unitSize) Sets unitSize and triggers a call to bigArrayFill() to reset the pattern in bigArray.void
shift
(int pixelShift, boolean isCounted) Shifts left by a specified number of pixels, summing them to argosyPixelShift if isCounted is true.void
basic animation, rotate left by animStep pixels, inccrement the step counter argosyShiftStepvoid
basic animation, rotate right by animStep pixels, decrement the step counter argosyShiftStep
-
Field Details
-
argosy55
public static int[] argosy55
-
-
Constructor Details
-
ArgosyArray
public ArgosyArray(int bigSize, int unitSize, int reps, boolean isCentered) - Parameters:
bigSize
- size of the arrayunitSize
- size of a unit of the argosyreps
- number of repetitions of the argosy pattern, pass in 0 for maximum that fitisCentered
- true if argosy array should be centered in bigArray
-
ArgosyArray
public ArgosyArray(int bigSize, int unitSize, int reps, boolean isCentered, int[] colors, int gapColor, float gapScale, int[] argosy) - Parameters:
bigSize
- size of the arrayunitSize
- size of a unit of the argosyreps
- number of repetitions of the argosy pattern, pass in 0 for maximum that fitisCentered
- true if argosy array should be centered in bigArraycolors
- an array of colors for the argosy patternsgapColor
- a color for the spaces between argosy patternsgapScale
- scaling for number of units in gap between argosiesargosy
- a pattern of numbers, will be copied to argosyPattern
-
-
Method Details
-
bigArrayFill
public void bigArrayFill()Sets up the big array and fills it with colors using the argosy pattern. -
argosyFill
public void argosyFill()Fill the big array with the argosy pattern, called by bigArrayFill. -
rotateLeft
public void rotateLeft(int d) Rotates bigArray left by d values. Uses efficient "Three Rotation" algorithm.- Parameters:
d
- number of elements to shift
-
shiftRight
public void shiftRight()basic animation, rotate right by animStep pixels, decrement the step counter argosyShiftStep -
shiftLeft
public void shiftLeft()basic animation, rotate left by animStep pixels, inccrement the step counter argosyShiftStep -
getArgosyPixelShift
public int getArgosyPixelShift()- Returns:
- the argosyPixelShift, save this if you want to reshift
-
shift
public void shift(int pixelShift, boolean isCounted) Shifts left by a specified number of pixels, summing them to argosyPixelShift if isCounted is true.- Parameters:
pixelShift
-isCounted
-
-
getBigArray
public int[] getBigArray()- Returns:
- bigArray, but you really should get a copy if you want to do anything with it
-
getBigArrayCopy
public int[] getBigArrayCopy()- Returns:
- a copy of bigArray
-
setBigArray
public void setBigArray(int[] bigArray) - Parameters:
bigArray
- the big array to set, must be same length as this.bigArray use at your own risk, for example to load a very big image into the big array
-
getUnitSize
public int getUnitSize()- Returns:
- the unitSize
-
setUnitSize
public void setUnitSize(int unitSize) Sets unitSize and triggers a call to bigArrayFill() to reset the pattern in bigArray.- Parameters:
unitSize
- the new unitSize
-
getAnimStep
public int getAnimStep()- Returns:
- the animStep, number of pixels to shift in an animation
-
setAnimStep
public void setAnimStep(int animStep) Set the animStep, with no side effects (but animation calls will use the new value)- Parameters:
animStep
-
-
getArgosyColors
public int[] getArgosyColors()- Returns:
- the array of colors for the argosy pattern elements
-
setArgosyColors
public void setArgosyColors(int[] argosyColors) Sets new argosyColors and triggers a call to bigArrayFill() to reset the pattern in bigArray.- Parameters:
argosyColors
-
-
getArgosyGapScale
public float getArgosyGapScale()- Returns:
- the argosyGapScale
-
setArgosyGapScale
public void setArgosyGapScale(float argosyGapScale) Sets argosyGapScale and triggers a call to bigArrayFill() to reset the pattern in bigArray.- Parameters:
argosyGapScale
-
-
getArgosyGap
public int getArgosyGap()- Returns:
- the argosyGap, number of pixels between iterations of the argosy pattern
-
setArgosyGap
public void setArgosyGap(int argosyGap) Sets argosyGap and triggers a call to bigArrayFill() to reset the pattern in bigArray. Usually it's better to set the argosyGapScale, but if you want a gap that isn't a multiple of unitSize, this is the way to do it.- Parameters:
argosyGap
-
-
getArgosyGapColor
public int getArgosyGapColor()- Returns:
- the argosyGapColor
-
setArgosyGapColor
public void setArgosyGapColor(int argosyGapColor) Sets argosyGapColor and triggers a call to bigArrayFill() to reset the pattern in bigArray.- Parameters:
argosyGapColor
-
-
getArgosyReps
public int getArgosyReps()- Returns:
- argosyReps, the number of repetitions of the argosy pattern in the array, set by bigArrayFill().
-
getArgosyMargin
public int getArgosyMargin()- Returns:
- argosyMargin, the left and right margin to argosy patterns in the array, set by bigArrayFill().
-
getArgosyPattern
public int[] getArgosyPattern()- Returns:
- the argosyPattern, an array with a numeric pattern.
-
setArgosyPattern
public void setArgosyPattern(int[] argosyPattern) Sets a new argosy pattern and triggers a call to bigArrayFill() to reset the pattern in bigArray.- Parameters:
argosyPattern
-
-
setNewColors
public void setNewColors(int[] argosyColors, int argosyGapColor) Sets new argosy colors and argosy gap color, triggers a call to bigArrayFill().- Parameters:
argosyColors
-argosyGapColor
-
-
fibo
An L-System generator for Fibonacci trees represented as a sequence of 0s and 1s.- Parameters:
depth
- depth of iteration of the L-System. A depth of 8 gets you an ArrayList with 34 elements.verbose
- Keep me informed. Or not.- Returns:
- an ArrayList of String values "1" and "0".
-
argosyGen
public int[] argosyGen(int depth, int v1, int v2, boolean verbose) Generates an argosy pattern based on a Fibonacci tree. Depth 8 gets you a 34 element sequence, and so Fibonacci forth. For example: int[] testPattern = argosyGen(8, 5, 8, true);- Parameters:
depth
- depth of iteration of the L-System. A depth of 8 gets you an array with 34 elements.v1
- value to substitute for a "0" in the ArrayList returned by fibo()v2
- value to substitute for a "1" in the ArrayList return by fibo()verbose
- if true, tells the console what's up- Returns:
- an array of ints determined by a Fibonacci tree generator and your inputs v1 and v2
-