mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
random functions in processingapplet, notes in todo
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user