Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage photo; //must be at most 600x600
- ArrayList<cPoint> points = new ArrayList<cPoint>();
- void setup() {
- size(600, 600, P3D);
- ortho();
- colorMode(HSB);
- for (int i = 0; i < 255; i++) {
- points.add(new cPoint(color(i, 255, 255)));
- }
- }
- void draw() {
- background(200);
- translate(width/2.0, height/2.0, 0);
- rotateX(PI-PI/8.0);
- rotateY(frameCount*PI/150+3.0*PI/2.0);
- rotateZ(frameCount*PI/135+3.0*PI/2.0);
- strokeWeight(1);
- stroke(0);
- noFill();
- translate(-127, -127, -127);
- strokeWeight(20);
- for (cPoint p : points) {
- p.show();
- }
- save("edit.jpg");
- points.clear();
- photo = loadImage("edit.jpg");
- for (int i = 0; i < photo.pixels.length; i += 11) {
- points.add(new cPoint(photo.pixels[i]));
- }
- }
- class cPoint {
- PVector pos;
- color col;
- cPoint(color c) {
- col = c;
- pos = new PVector(red(c), green(c), blue(c));
- }
- void show() {
- stroke(col);
- point(pos.x, pos.y, pos.z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement