mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 19:31:16 +01:00
Removing extrusion example
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Extrusion.
|
||||
*
|
||||
* Converts a flat image into spatial data points and rotates the points
|
||||
* around the center.
|
||||
*/
|
||||
|
||||
// @pjs preload must be used to preload media if the program is
|
||||
// running with Processing.js
|
||||
/* @pjs preload="moon.jpg"; */
|
||||
|
||||
PImage extrude;
|
||||
int[][] values;
|
||||
float angle = 0;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P3D);
|
||||
|
||||
// Load the image into a new array
|
||||
extrude = loadImage("ystone08.jpg");
|
||||
extrude.loadPixels();
|
||||
values = new int[extrude.width][extrude.height];
|
||||
for (int y = 0; y < extrude.height; y++) {
|
||||
for (int x = 0; x < extrude.width; x++) {
|
||||
color pixel = extrude.get(x, y);
|
||||
values[x][y] = int(brightness(pixel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
|
||||
// Update the angle
|
||||
angle += 0.005;
|
||||
|
||||
// Rotate around the center axis
|
||||
translate(width/2, 0, -128);
|
||||
rotateY(angle);
|
||||
translate(-extrude.width/2, 100, -128);
|
||||
|
||||
// Display the image mass
|
||||
for (int y = 0; y < extrude.height; y++) {
|
||||
for (int x = 0; x < extrude.width; x++) {
|
||||
stroke(values[x][y]);
|
||||
point(x, y, -values[x][y]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user