As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Friday, October 5, 2018

Processing Experiment


Processing Experiment

I picked "Ribbons" from example to experiment.

Original Code Visual:




Experimented Code Visual:




// Ribbons, by Andres Colubri
// ArcBall class by Ariel, V3ga and Robert Hodgin (flight404)
// This sketch loads 3D atomic coordinates of a protein molecule
// from a file in PDB format (http://www.pdb.org/) and displays
// the structure using a ribbon representation.

String pdbFile = "4HHB.pdb"; // PDB file to read
//String pdbFile = "1CBS.pdb";
//String pdbFile = "2POR.pdb";

// Some parameters to control the visual appearance:
float scaleFactor = 10;          // Size factor
int renderMode = 1;             // 0 = lines, 1 = flat ribbons
int ribbonDetail = 4;           // Ribbon detail: from 1 (lowest) to 4 (highest)
float helixDiam = 50;           // Helix diameter.   Changed ribbon's diameter from 10 to 50 to make the ribbon's width wider. 
int[] ribbonWidth = {20, 14, 4}; // Ribbon widths for helix, strand and coil  Increased width, strand and coil twice higher to make it look more busy. 
color ribbonColor = color(255, 102, 153, 255); // Ribbon color  Changed color from blue to pink

// All the molecular models read from the PDB file (it could contain more than one)
ArrayList models;

Arcball arcball;

void setup() {
  size(300, 800, P3D);  Changed the window size to a vertically long window to make it look like a banner. 

  arcball = new Arcball(width/2, height/2, 600);
  readPDB(pdbFile);
}

void draw() {
  background(0);  Went from gray background color to black. 

  ambient(100);
  lights();

  translate(width/2, height/2, 200);
  arcball.run();

  for (int i = 0; i < models.size(); i++) {
    shape((PShape)models.get(i));
  }
}

void mousePressed(){
  arcball.mousePressed();
}

void mouseDragged(){
  arcball.mouseDragged();
}

No comments:

Post a Comment