public class DawesomeToolkit
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
BIANCA |
int |
BITTERSWEET |
int |
ONYX |
int |
RICECAKE |
Constructor and Description |
---|
DawesomeToolkit(PApplet parent) |
Modifier and Type | Method and Description |
---|---|
PVector |
cartesianToPolar(PVector vector)
Converts Cartesian coordinates to polar coordinates
|
java.util.ArrayList<PVector> |
centerPVectors(java.util.ArrayList<PVector> vectors)
Centers a list of PVectors in the x and y axis so that 0,0 is the center point
|
java.util.ArrayList<PVector> |
circularLayout(int numItems,
float radius)
Creates a pattern of PVectors distributed around a circle
|
java.util.ArrayList |
colorSpectrum(int numItems,
float saturation,
float brightness)
Creates an ArrayList color spectrum
|
void |
disableLazySave() |
float |
distanceBetweenLatLonInKilometers(float lat1,
float lon1,
float lat2,
float lon2)
Get the distance in KM between two lat lon coordinates
|
float |
distanceBetweenLatLonInMiles(float lat1,
float lon1,
float lat2,
float lon2) |
void |
drawBaselineGuide(int color,
float spacing)
Draws a baseline grid
|
void |
drawCenterGuide(int color)
Draws a center guide onto the canvas
|
void |
drawThirdsGuide(int color)
Draws a thirds guide onto the canvas
|
void |
enableLazySave()
Enables pressing the 's' key to save screenshot in png format
|
void |
enableLazySave(char saveKey,
java.lang.String saveFormat)
Enables pressing a key to save screenshot with a unique date based filename
|
void |
enableLazySave(char saveKey,
java.lang.String saveFormat,
java.lang.String saveAppend) |
void |
exportColorsToHtmlSwatchGuide(int[] colors)
Export Colors to HTML Swatch Guide
|
java.util.ArrayList<PVector> |
fibonacciSphereLayout(int numItems,
float radius)
Creates a Fibonacci distribution of PVectors around a sphere
Original code from http://www.openprocessing.org/sketch/103897
|
float |
floatToLat(float f,
float minimum,
float maximum)
Maps a float to latitude in degrees
|
float |
floatToLon(float f,
float minimum,
float maximum)
Maps a float to longitude in degrees
|
PVector |
getCartesian(float radius,
float lat,
float lon)
Converts radius, lat, lon to a PVector of world coordinates
|
PVector |
getMaxValueFromListOfPVectors(java.util.ArrayList<PVector> vectors)
Gets the max x y z values from a list of PVectors
|
PVector |
getMinValueFromListOfPVectors(java.util.ArrayList<PVector> vectors)
Gets the min x y z values from a list of PVectors
|
java.util.ArrayList<PVector> |
gridLayout(int numItems,
int xStep,
int yStep,
int cols)
Creates a grid of PVectors
|
java.lang.String |
ipAddress()
Returns the ip address for this machine
|
boolean |
isWordInString(java.lang.String needle,
java.lang.String haystack)
Detects if a word is present in a string
|
java.util.ArrayList |
iWantHue()
Creates an ArrayList of 12 unique colors defined by the iwanthue algorithm
|
void |
keyEvent(KeyEvent e) |
java.util.ArrayList<PVector> |
lineAroundSphere(PVector p1,
PVector p2,
float radius)
Creates a list of PVectors to map a line around a sphere
|
float |
map(float value,
float istart,
float istop,
float ostart,
float ostop) |
java.util.ArrayList<PVector> |
mapPVectorsAroundSphere(java.util.ArrayList<PVector> vectors,
float radius,
float offset)
Maps a list of PVectors around a sphere
|
java.util.ArrayList<PVector> |
maskToVectors(PImage img)
Takes a black and white image and returns an ArrayList of vectors for any non-white pixels
|
java.util.ArrayList<PVector> |
maskToVectors(java.lang.String file)
Takes a black and white image and returns an ArrayList of vectors for any non-white pixels
|
java.util.ArrayList<PVector> |
multiplyPVectors(java.util.ArrayList<PVector> vectors,
float scaler)
Multiplies (scales) an ArrayList of PVectors
|
PVector |
multXY(PVector vector,
float scalerX,
float scalerY)
Multiply a PVector using X and Y
|
int |
numberOfDaysBetweenDates(java.util.Date d1,
java.util.Date d2)
Get the number of days between two dates
|
java.util.ArrayList |
reverse(java.util.ArrayList list)
Reverse an ArrayList
|
java.util.ArrayList<PVector> |
rotatePVectors(java.util.ArrayList<PVector> vectors,
float angle)
Rotates an ArrayList of PVectors
|
java.util.ArrayList |
shuffle(java.util.ArrayList list)
Shuffles an ArrayList using a random seed
|
PVector |
snapToGrid(PVector loc,
float sizeOfGrid)
Snap a PVector to a grid
|
java.util.ArrayList |
sort(java.util.ArrayList list)
Simple sorting of an ArrayList
|
java.util.ArrayList<PVector> |
spiralLayout(int numItems,
float radius,
float resolution,
float spacing,
float inc)
Creates a spiral pattern of PVectors
|
java.lang.String |
timestamp()
Returns a current timestamp
|
java.lang.String |
timestamp(java.lang.String dateFormat)
Returns a current timestamp
|
java.lang.String |
uniqueFileName()
Returns a unique filename made up from date and time and random number.
|
java.util.ArrayList<PVector> |
vogelLayout(int numItems,
int sizeOfNode)
Creates a Vogel spiral pattern of PVectors
|
public final int BITTERSWEET
public final int BIANCA
public final int ONYX
public final int RICECAKE
public void enableLazySave(char saveKey, java.lang.String saveFormat)
saveKey
- a char defining the key to usesaveFormat
- a string defining the file extension type and format eg .pngpublic void enableLazySave(char saveKey, java.lang.String saveFormat, java.lang.String saveAppend)
public void enableLazySave()
public void disableLazySave()
public void keyEvent(KeyEvent e)
public final float map(float value, float istart, float istop, float ostart, float ostop)
public java.lang.String uniqueFileName()
public java.lang.String ipAddress()
public java.lang.String timestamp(java.lang.String dateFormat)
dateFormat
- a String defining the date formatpublic java.lang.String timestamp()
public boolean isWordInString(java.lang.String needle, java.lang.String haystack)
needle
- the string to findhaystack
- the string to searchpublic int numberOfDaysBetweenDates(java.util.Date d1, java.util.Date d2)
d1
- first Date objectd2
- second Date objectpublic float distanceBetweenLatLonInKilometers(float lat1, float lon1, float lat2, float lon2)
lat1
- first latlon1
- first lonlat2
- second latlon2
- second lonpublic float distanceBetweenLatLonInMiles(float lat1, float lon1, float lat2, float lon2)
public void drawCenterGuide(int color)
color
- an int defining the color of the guidepublic void drawThirdsGuide(int color)
color
- an int defining the color of the guidepublic void drawBaselineGuide(int color, float spacing)
color
- an int defining the color of the guidespacing
- a float defining the vertical spacingpublic PVector getMinValueFromListOfPVectors(java.util.ArrayList<PVector> vectors)
vectors
- a PVector ArrayList of vectorspublic PVector getMaxValueFromListOfPVectors(java.util.ArrayList<PVector> vectors)
vectors
- a PVector ArrayList of vectorspublic java.util.ArrayList<PVector> centerPVectors(java.util.ArrayList<PVector> vectors)
vectors
- a PVector ArrayList of vectorspublic java.util.ArrayList<PVector> multiplyPVectors(java.util.ArrayList<PVector> vectors, float scaler)
vectors
- a PVector ArrayList of PVectorsscaler
- the scaler valuepublic java.util.ArrayList<PVector> rotatePVectors(java.util.ArrayList<PVector> vectors, float angle)
vectors
- a PVector ArrayList of PVectorsangle
- the angle valuepublic java.util.ArrayList<PVector> gridLayout(int numItems, int xStep, int yStep, int cols)
numItems
- the number of items in the gridxStep
- the spacing in the x directionyStep
- the spacing in the y directioncols
- the number of columnspublic java.util.ArrayList<PVector> vogelLayout(int numItems, int sizeOfNode)
numItems
- the number of itemssizeOfNode
- the size of an individual nodepublic java.util.ArrayList<PVector> circularLayout(int numItems, float radius)
numItems
- the number of itemsradius
- the radius of the circlepublic java.util.ArrayList<PVector> spiralLayout(int numItems, float radius, float resolution, float spacing, float inc)
numItems
- the number of itemsradius
- a float defining the radius of the circleresolution
- a float defining the resolutionspacing
- a float defining the spacinginc
- a float defining the incrementpublic java.util.ArrayList<PVector> fibonacciSphereLayout(int numItems, float radius)
numItems
- the number of itemsradius
- a float defining the radius of the circlepublic PVector getCartesian(float radius, float lat, float lon)
radius
- a float defining the radiuslat
- a float in degrees defining the latitudelon
- a float in degrees defining the longitudepublic float floatToLat(float f, float minimum, float maximum)
f
- the float to mapminimum
- the minium value of fmaximum
- the maximum value of fpublic float floatToLon(float f, float minimum, float maximum)
f
- the float to mapminimum
- the minium value of fmaximum
- the maximum value of fpublic PVector cartesianToPolar(PVector vector)
vector
- the PVector to convertpublic java.util.ArrayList<PVector> mapPVectorsAroundSphere(java.util.ArrayList<PVector> vectors, float radius, float offset)
vectors
- a PVector ArrayList of PVectorsradius
- a float defining the radiusoffset
- a float defining the offset from the polespublic java.util.ArrayList<PVector> lineAroundSphere(PVector p1, PVector p2, float radius)
p1
- the PVector of the first pointp2
- the PVector of the second pointradius
- a float defining the radiuspublic PVector multXY(PVector vector, float scalerX, float scalerY)
vector
- the PVectorscalerX
- a float defining the scale of XscalerY
- a float defining the scale of Ypublic PVector snapToGrid(PVector loc, float sizeOfGrid)
loc
- the PVector to snapsizeOfGrid
- a float defining the size of the grid to snap topublic java.util.ArrayList colorSpectrum(int numItems, float saturation, float brightness)
numItems
- an int defining the number of colors to generatesaturation
- a float between 0 and 1.0 defining the saturation valuebrightness
- a float between 0 and 1.0 defining the brightness valuepublic java.util.ArrayList iWantHue()
public java.util.ArrayList<PVector> maskToVectors(java.lang.String file)
file
- a string defining the location of the imagepublic java.util.ArrayList<PVector> maskToVectors(PImage img)
img
- a PImagepublic java.util.ArrayList shuffle(java.util.ArrayList list)
list
- an ArrayList that you want to shufflepublic java.util.ArrayList sort(java.util.ArrayList list)
list
- an ArrayList that you want to sortpublic java.util.ArrayList reverse(java.util.ArrayList list)
list
- an ArrayList that you want to reversepublic void exportColorsToHtmlSwatchGuide(int[] colors)
colors
- an int array of colors