public class DetailedMimic
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
AestheticDifference |
difference |
IRNG |
random |
Constructor and Description |
---|
DetailedMimic()
Constructor that uses an unseeded RNG and, without any instruction otherwise, assumes the ints this is asked to
compare are colors in RGBA8888 format.
|
DetailedMimic(AestheticDifference diff)
Constructor that uses an unseeded RNG (effectively a random seed) and the given AestheticDifference.
|
DetailedMimic(AestheticDifference diff,
IRNG rng)
Constructor that uses the given RNG and the given AestheticDifference.
|
Modifier and Type | Method and Description |
---|---|
void |
analyze(int[] sample,
int width,
int height,
int detailLevel,
int proximity,
boolean discrete)
DISCOURAGED; use
neoProcess(int[], int, int, int, int, int, int, boolean) instead, which doesn't need a
separate analysis step. |
static int[] |
convertCharToInt(char[][] map)
Utility method to produce 1D int arrays this can process when discrete is true or difference is null.
|
static char[][] |
convertIntToChar(int[] arr,
int w,
int h)
Utility method that takes a 1D int array that represents chars (such as a sample produced by
convertCharToInt(char[][]) or, more likely, the result of processing such a sample with this class) and
returns a 2D char array with the requested width and height (which should match the targetWidth and targetHeight
given during processing). |
int[] |
neoProcess(int[] sample,
int sampleWidth,
int sampleHeight,
int targetWidth,
int targetHeight,
int detailLevel,
int proximity,
boolean discrete)
Processes a 1D int array representing 2D storage of values that can be compared by this object's
AestheticDifference (or any values if that is null or discrete is true), and returns a 1D array representing data
with potentially different dimensions but similar appearance to sample.
|
int[] |
process(int[] sample,
int sampleWidth,
int sampleHeight,
int targetWidth,
int targetHeight,
int detailLevel,
int proximity,
double temperature,
boolean discrete)
DISCOURAGED; use
neoProcess(int[], int, int, int, int, int, int, boolean) instead, which doesn't need a
separate analysis step. |
public IRNG random
public AestheticDifference difference
public DetailedMimic()
public DetailedMimic(AestheticDifference diff)
AestheticDifference.difference(int, int)
; it is also considered a functional interface if you use Java 8
or newer. You can also use the ready-made implementation AestheticDifference.rgba8888
if you have int
data that represents RGBA8888 colors, which can be obtained from libGDX Colors or SColors in the display module.diff
- an implementation of the AestheticDifference interface, such as AestheticDifference.rgba8888
;
may be null, but that forces all calls to processing methods to treat discrete as truepublic DetailedMimic(AestheticDifference diff, IRNG rng)
AestheticDifference.difference(int, int)
; it is also considered a functional interface if you use Java 8
or newer. You can also use the ready-made implementation AestheticDifference.rgba8888
if you have int
data that represents RGBA8888 colors, which can be obtained from libGDX Colors or SColors in the display module.diff
- an implementation of the AestheticDifference interface, such as AestheticDifference.rgba8888
;
may be null, but that forces all calls to processing methods to treat discrete as truerng
- an IRNG, such as an RNG, to generate random factors; may be seeded to produce reliable outputpublic void analyze(int[] sample, int width, int height, int detailLevel, int proximity, boolean discrete)
neoProcess(int[], int, int, int, int, int, int, boolean)
instead, which doesn't need a
separate analysis step.
Analyzes a sample as a 1D int array and stores the needed info to call
process(int[], int, int, int, int, int, int, double, boolean)
any number of times later on without
recalculating some heavy-weight information.sample
- a 1D array of ints that can be compared by the AestheticDifference this uses (or any ints if
discrete is true)width
- the width of the area in sample this should use (sample can be interpreted as different shapes)height
- the height of the area in sample this should use (sample can be interpreted as different shapes)detailLevel
- how much detail to try for; if 0 or less this does nothing, 2 works well in generalproximity
- how far away to consider cells as affecting another; 3 works welldiscrete
- false if this can produce ints other than those in the input; true if it uses a fixed setpublic int[] process(int[] sample, int sampleWidth, int sampleHeight, int targetWidth, int targetHeight, int detailLevel, int proximity, double temperature, boolean discrete)
neoProcess(int[], int, int, int, int, int, int, boolean)
instead, which doesn't need a
separate analysis step.
Processes a sample as a 1D int array and returns a different 1D int array that mimics the input. If the last time
this was called used the same sample, sampleWidth, and sampleHeight parameters, or if
analyze(int[], int, int, int, int, boolean)
was called with its width equal to sampleWidth and its
height equal to sampleHeight, then this doesn't need to perform as many expensive calculations.sample
- a 1D array of ints that can be compared by the AestheticDifference this uses (or any ints if
discrete is true)sampleWidth
- the width of the area in sample this should use (sample can be interpreted as different shapes)sampleHeight
- the height of the area in sample this should use (sample can be interpreted as different shapes)targetWidth
- the desired width of the outputtargetHeight
- the desired height of the outputdetailLevel
- how much detail to try for; if 0 or less this doesn't perform analysis and has somewhat lower
quality, but 2 works well in generalproximity
- how far away to consider cells as affecting another; 3 works welltemperature
- a level of unpredictability in the output relative to the input; must be greater than 0discrete
- false if this can produce ints other than those in the input; true if it uses a fixed setpublic int[] neoProcess(int[] sample, int sampleWidth, int sampleHeight, int targetWidth, int targetHeight, int detailLevel, int proximity, boolean discrete)
sample
- a 1D array of ints that can be compared by the AestheticDifference this uses (or any ints if
discrete is true)sampleWidth
- the width of the area in sample this should use (sample can be interpreted as different shapes)sampleHeight
- the height of the area in sample this should use (sample can be interpreted as different shapes)targetWidth
- the desired width of the outputtargetHeight
- the desired height of the outputdetailLevel
- how much detail to try for; here this will always be treated as at least 1proximity
- how far away to consider cells as affecting another; 3 works welldiscrete
- false if this can produce ints other than those in the input; true if it uses a fixed setpublic static int[] convertCharToInt(char[][] map)
map
- a 2D char arraypublic static char[][] convertIntToChar(int[] arr, int w, int h)
convertCharToInt(char[][])
or, more likely, the result of processing such a sample with this class) and
returns a 2D char array with the requested width and height (which should match the targetWidth and targetHeight
given during processing).arr
- a 1D int array that represents char valuesw
- the width that arr can be interpreted as; should probably match the targetWidth given in processingh
- the height that arr can be interpreted as; should probably match the targetHeight given in processingCopyright © Eben Howard 2012–2022. All rights reserved.