mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
removing applet folders from svn
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
import processing.core.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class Graphing2DEquation extends PApplet {
|
||||
|
||||
/**
|
||||
* Graphing 2D Equations
|
||||
* by Daniel Shiffman.
|
||||
*
|
||||
* Graphics the following equation:
|
||||
* sin(n*cos(r) + 5*theta)
|
||||
* where n is a function of horizontal mouse location.
|
||||
*/
|
||||
|
||||
public void setup() {
|
||||
size(200,200);
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
loadPixels();
|
||||
float n = (mouseX * 10.0f) / width;
|
||||
float w = 16.0f; // 2D space width
|
||||
float h = 16.0f; // 2D space height
|
||||
float dx = w / width; // Increment x this amount per pixel
|
||||
float dy = h / height; // Increment y this amount per pixel
|
||||
float x = -w/2; // Start x at -1 * width / 2
|
||||
for (int i = 0; i < width; i++) {
|
||||
float y = -h/2; // Start y at -1 * height / 2
|
||||
for (int j = 0; j < height; j++) {
|
||||
float r = sqrt((x*x) + (y*y)); // Convert cartesian to polar
|
||||
float theta = atan2(y,x); // Convert cartesian to polar
|
||||
// Compute 2D polar coordinate function
|
||||
float val = sin(n*cos(r) + 5 * theta); // Results in a value between -1 and 1
|
||||
//float val = cos(r); // Another simple function
|
||||
//float val = sin(theta); // Another simple function
|
||||
// Map resulting vale to grayscale value
|
||||
pixels[i+j*width] = color((val + 1.0f) * 255.0f/2.0f); // Scale to between 0 and 255
|
||||
y += dy; // Increment y
|
||||
}
|
||||
x += dx; // Increment x
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "Graphing2DEquation" });
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Graphing 2D Equations
|
||||
* by Daniel Shiffman.
|
||||
*
|
||||
* Graphics the following equation:
|
||||
* sin(n*cos(r) + 5*theta)
|
||||
* where n is a function of horizontal mouse location.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
size(200,200);
|
||||
frameRate(30);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
loadPixels();
|
||||
float n = (mouseX * 10.0) / width;
|
||||
float w = 16.0; // 2D space width
|
||||
float h = 16.0; // 2D space height
|
||||
float dx = w / width; // Increment x this amount per pixel
|
||||
float dy = h / height; // Increment y this amount per pixel
|
||||
float x = -w/2; // Start x at -1 * width / 2
|
||||
for (int i = 0; i < width; i++) {
|
||||
float y = -h/2; // Start y at -1 * height / 2
|
||||
for (int j = 0; j < height; j++) {
|
||||
float r = sqrt((x*x) + (y*y)); // Convert cartesian to polar
|
||||
float theta = atan2(y,x); // Convert cartesian to polar
|
||||
// Compute 2D polar coordinate function
|
||||
float val = sin(n*cos(r) + 5 * theta); // Results in a value between -1 and 1
|
||||
//float val = cos(r); // Another simple function
|
||||
//float val = sin(theta); // Another simple function
|
||||
// Map resulting vale to grayscale value
|
||||
pixels[i+j*width] = color((val + 1.0) * 255.0/2.0); // Scale to between 0 and 255
|
||||
y += dy; // Increment y
|
||||
}
|
||||
x += dx; // Increment x
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user