|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgenerativedesign.GenerativeDesign
public class GenerativeDesign
This class collects static methods that are used in several sketches of the book. 'Static' means, that you don't need to create an instance of this class to use one of the methods. For example, if you want to print the version number of this library just type: println(GenerativeDesign.version());
Field Summary | |
---|---|
static String |
ALPHA
Constant to be used with the function sortColors. |
static String |
BLUE
Constant to be used with the function sortColors. |
static String |
BRIGHTNESS
Constant to be used with the function sortColors. |
static String |
GRAYSCALE
Constant to be used with the function sortColors. |
static String |
GREEN
Constant to be used with the function sortColors. |
static int |
HTML_CONTENT
Constant to be used as a mode with the class AsyncHTMLLoader. |
static int |
HTML_PLAIN
Constant to be used as a mode with the class AsyncHTMLLoader. |
static String |
HUE
Constant to be used with the function sortColors. |
static String |
RED
Constant to be used with the function sortColors. |
static String |
SATURATION
Constant to be used with the function sortColors. |
static String |
VERSION
|
Constructor Summary | |
---|---|
GenerativeDesign()
|
Method Summary | |
---|---|
static float |
angleDifference(float theAngle1,
float theAngle2)
Calculates the minimal difference of two angles given in radians. |
static float[] |
cartesianToPolar(float theX,
float theY)
Converts 2D cartesian coordinates to polar coordinates |
static float[] |
cartesianToPolar(float theX,
float theY,
float theZ)
Converts 3D cartesian coordinates to polar coordinates |
static PVector |
cartesianToPolar(PVector theVector)
Converts 3D cartesian coordinates to polar coordinates |
static float[] |
HSBtoRGB(float theH,
float theS,
float theB)
Converts a HSB color to RGB. |
static ArrayList<String> |
loadHTMLAsync(PApplet theParent,
String theURL)
Loads a HTML-File asynchronously |
static ArrayList<String> |
loadHTMLAsync(PApplet theParent,
String theURL,
int theMode)
Loads a HTML-File asynchronously |
static PImage |
loadImageAsync(PApplet theParent,
String thePath)
Loads an image file asynchronously |
static XML |
loadXMLAsync(PApplet theParent,
String theURL)
Loads a XML-File asynchronously |
static float[] |
polarToCartesian(float theLength,
float theAngle)
Converts 2D polar coordinates to cartesian coordinates |
static float[] |
polarToCartesian(float theLength,
float theAngleY,
float theAngleZ)
Converts 3D polar coordinates to cartesian coordinates |
static PVector |
polarToCartesian(PVector theVector)
Converts 3D polar coordinates to cartesian coordinates |
static float[] |
RGBtoHSB(float theR,
float theG,
float theB)
Converts a RGB color to HSB. |
static void |
saveASE(PApplet theParent,
int[] theColors,
String theFileName)
Exports an .ase (Adobe Swatch Echange) file with default names |
static void |
saveASE(PApplet theParent,
int[] theColors,
String[] theNames,
String theFileName)
Exports an .ase (Adobe Swatch Echange) file |
static int[] |
sortColors(PApplet theParent,
int[] theColors,
String theMethod)
Sorts a list of colors |
static String |
timestamp()
|
static void |
unsort(ArrayList<Object> theList)
Takes an ArrayList and reorders the elements randomly. |
static String |
version()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String VERSION
public static String RED
public static String GREEN
public static String BLUE
public static String HUE
public static String SATURATION
public static String BRIGHTNESS
public static String GRAYSCALE
public static String ALPHA
public static int HTML_PLAIN
public static int HTML_CONTENT
Constructor Detail |
---|
public GenerativeDesign()
Method Detail |
---|
public static String version()
public static String timestamp()
public static float[] RGBtoHSB(float theR, float theG, float theB)
theR
- Red value (0-255)theG
- Green value (0-255)theB
- Blue value (0-255)
public static float[] HSBtoRGB(float theH, float theS, float theB)
theH
- Hue value (0-360)theS
- Saturation value (0-100)theB
- Brightness value (0-100)
public static int[] sortColors(PApplet theParent, int[] theColors, String theMethod)
theParent
- Reference to a PApplet. Typically use "this"theColors
- Array of colors to sorttheMethod
- Sorting method: one of the constants RED, GREEN, BLUE, HUE,
SATURATION, BRIGHTNESS, ALPHA, GRAYSCALE
public static void saveASE(PApplet theParent, int[] theColors, String theFileName)
theParent
- Reference to a PApplet. Typically use "this"theColors
- color values (rgb 0-255) of the swatchestheFileName
- filename of the .ase filepublic static void saveASE(PApplet theParent, int[] theColors, String[] theNames, String theFileName)
theParent
- Reference to a PApplet. Typically use "this"theColors
- color values (rgb 0-255) of the swatchestheNames
- names of the swatchestheFileName
- filename of the .ase filepublic static PImage loadImageAsync(PApplet theParent, String thePath)
theParent
- Reference to a PApplet. Typically use "this"thePath
- Path/filename to load
public static XML loadXMLAsync(PApplet theParent, String theURL)
theParent
- Reference to a PApplet. Typically use "this"theURL
- URL or filename to load
public static ArrayList<String> loadHTMLAsync(PApplet theParent, String theURL)
theParent
- Reference to a PApplet. Typically use "this"theURL
- URL or filename to load
public static ArrayList<String> loadHTMLAsync(PApplet theParent, String theURL, int theMode)
theParent
- Reference to a PApplet. Typically use "this"theURL
- URL or filename to loadtheMode
- The mode for the text that will be returned. Either HTML_PLAIN
(plain html code with all tags) or HTML_CONTENT (just the text
that is shown on the website)
public static float angleDifference(float theAngle1, float theAngle2)
theAngle1
- Angle to subtract fromtheAngle2
- Angle to subtract
public static float[] cartesianToPolar(float theX, float theY)
theX
- X-coordinatetheY
- Y-coordinate
public static float[] cartesianToPolar(float theX, float theY, float theZ)
theX
- X-coordinatetheY
- Y-coordinatetheZ
- Z-coordinate
public static PVector cartesianToPolar(PVector theVector)
theVector
- vector to convert
public static float[] polarToCartesian(float theLength, float theAngle)
theLength
- Distance of the point to the origintheAngle
- Angle
public static float[] polarToCartesian(float theLength, float theAngleY, float theAngleZ)
theLength
- Distance of the point to the origintheAngleY
- Angle for rotation around y-axistheAngleZ
- Angle for rotation around z-axis
public static PVector polarToCartesian(PVector theVector)
theVector
- Vector containing (length, angleY, angleZ), where 'length' is
distance of the point to the origin, 'angleY' is the angle for
rotation around y-axis and 'angleZ' is the angle for rotation
around z-axis
public static void unsort(ArrayList<Object> theList)
theList
- ArrayList to unsort
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |