random functions in processingapplet, notes in todo

This commit is contained in:
benfry
2001-10-03 22:22:46 +00:00
parent 207b54e32d
commit f4ceff986b
2 changed files with 51 additions and 21 deletions
+44 -21
View File
@@ -509,24 +509,11 @@ public class ProcessingApplet extends Applet
// math stuff for convenience
public final float sin(float angle) {
return (float)Math.sin(angle);
}
public final float cos(float angle) {
return (float)Math.cos(angle);
public final float abs(float n) {
return (n < 0) ? -n : n;
}
public final float tan(float angle) {
return (float)Math.tan(angle);
}
public final float atan2(float a, float b) {
return (float)Math.atan2(a, b);
}
public final float sq(float a) {
return a*a;
}
@@ -539,10 +526,6 @@ public class ProcessingApplet extends Applet
return (float)Math.pow(a, b);
}
public final float abs(float n) {
return (n < 0) ? -n : n;
}
public final float max(float a, float b) {
return Math.max(a, b);
@@ -561,8 +544,48 @@ public class ProcessingApplet extends Applet
}
public final float random() {
return (float)Math.random();
public final float sin(float angle) {
return (float)Math.sin(angle);
}
public final float cos(float angle) {
return (float)Math.cos(angle);
}
public final float tan(float angle) {
return (float)Math.tan(angle);
}
public final float atan2(float a, float b) {
return (float)Math.atan2(a, b);
}
//public final float randomf() {
//return ((float)Math.random() - 0.5f)*2.0f;
//}
//public final float randomuf() {
//return (float)Math.random();
//}
public final float random(float howbig) {
return (float)Math.random() * howbig;
}
public final float random(float howsmall, float howbig) {
float diff = howbig - howsmall;
return howsmall + (float)Math.random() * diff;
}
public final int random(int howbig) {
return (int) (Math.random() * (double)howbig);
}
public final int random(int howsmall, int howbig) {
double diff = howbig - howsmall;
return howsmall + (int) (Math.random() * diff);
}
+7
View File
@@ -3,6 +3,13 @@ iprocessing todo list // last updated 28 september 2001
for 0010
_ make note in documentation about getting access to pixel array
_ check to see if get/set functions in applet actually work
_ fix documentation appropriately
X redone random functions in processing applet
_ update documentation on web page
_ crappy way of determining if inside a class--ignores comments
_ documentation says 'mouseDown' even though it's 'mousePressed'
_ option to enable/disable frame on running applets
_ compiling .java files leaves the .class files next to the .java
_ make sure all the dirs in sketchbook added to classpath on startup