|
|||||||||
| 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 java.lang.String |
ALPHA
Constant to be used with the function sortColors. |
static java.lang.String |
BLUE
Constant to be used with the function sortColors. |
static java.lang.String |
BRIGHTNESS
Constant to be used with the function sortColors. |
static java.lang.String |
GRAYSCALE
Constant to be used with the function sortColors. |
static java.lang.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 java.lang.String |
HUE
Constant to be used with the function sortColors. |
static java.lang.String |
RED
Constant to be used with the function sortColors. |
static java.lang.String |
SATURATION
Constant to be used with the function sortColors. |
static java.lang.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 processing.core.PVector |
cartesianToPolar(processing.core.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 java.util.ArrayList<java.lang.String> |
loadHTMLAsync(processing.core.PApplet theParent,
java.lang.String theURL)
Loads a HTML-File asynchronously |
static java.util.ArrayList<java.lang.String> |
loadHTMLAsync(processing.core.PApplet theParent,
java.lang.String theURL,
int theMode)
Loads a HTML-File asynchronously |
static processing.core.PImage |
loadImageAsync(processing.core.PApplet theParent,
java.lang.String thePath)
Loads an image file asynchronously |
static XMLElement |
loadXMLAsync(processing.core.PApplet theParent,
java.lang.String theURL)
Loads a XML-File asynchronously. |
static processing.data.XML |
loadXMLAsync2(processing.core.PApplet theParent,
java.lang.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 processing.core.PVector |
polarToCartesian(processing.core.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(processing.core.PApplet theParent,
int[] theColors,
java.lang.String theFileName)
Exports an .ase (Adobe Swatch Echange) file with default names |
static void |
saveASE(processing.core.PApplet theParent,
int[] theColors,
java.lang.String[] theNames,
java.lang.String theFileName)
Exports an .ase (Adobe Swatch Echange) file |
static int[] |
sortColors(processing.core.PApplet theParent,
int[] theColors,
java.lang.String theMethod)
Sorts a list of colors |
static java.lang.String |
timestamp()
|
static void |
unsort(java.util.ArrayList<java.lang.Object> theList)
Takes an ArrayList and reorders the elements randomly. |
static java.lang.String |
version()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String VERSION
public static java.lang.String RED
public static java.lang.String GREEN
public static java.lang.String BLUE
public static java.lang.String HUE
public static java.lang.String SATURATION
public static java.lang.String BRIGHTNESS
public static java.lang.String GRAYSCALE
public static java.lang.String ALPHA
public static int HTML_PLAIN
public static int HTML_CONTENT
| Constructor Detail |
|---|
public GenerativeDesign()
| Method Detail |
|---|
public static java.lang.String version()
public static java.lang.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(processing.core.PApplet theParent,
int[] theColors,
java.lang.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(processing.core.PApplet theParent,
int[] theColors,
java.lang.String theFileName)
theParent - Reference to a PApplet. Typically use "this"theColors - color values (rgb 0-255) of the swatchestheFileName - filename of the .ase file
public static void saveASE(processing.core.PApplet theParent,
int[] theColors,
java.lang.String[] theNames,
java.lang.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 file
public static processing.core.PImage loadImageAsync(processing.core.PApplet theParent,
java.lang.String thePath)
theParent - Reference to a PApplet. Typically use "this"thePath - Path/filename to load
public static processing.data.XML loadXMLAsync2(processing.core.PApplet theParent,
java.lang.String theURL)
theParent - Reference to a PApplet. Typically use "this"theURL - URL or filename to load
public static XMLElement loadXMLAsync(processing.core.PApplet theParent,
java.lang.String theURL)
theParent - Reference to a PApplet. Typically use "this"theURL - URL or filename to load
public static java.util.ArrayList<java.lang.String> loadHTMLAsync(processing.core.PApplet theParent,
java.lang.String theURL)
theParent - Reference to a PApplet. Typically use "this"theURL - URL or filename to load
public static java.util.ArrayList<java.lang.String> loadHTMLAsync(processing.core.PApplet theParent,
java.lang.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 processing.core.PVector cartesianToPolar(processing.core.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 processing.core.PVector polarToCartesian(processing.core.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(java.util.ArrayList<java.lang.Object> theList)
theList - ArrayList to unsort
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||