We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Please help with concrete task
Page Index Toggle Pages: 1
Please help with concrete task (Read 464 times)
Please help with concrete task
Feb 18th, 2009, 10:09pm
 
Good day. I have a concrete task and I need to realize it.
I've made a prototype using 3DMaxScript and Now I want to do the same using processing.

I would like to do such thing:
http://lh5.ggpht.com/_s-YtUTv4mH4/SZkcJoRBWMI/AAAAAAAAASI/lQqkpmzAYK4/s800/4993e36221d972.15939376.jpg

Please see algorithm:

1. Create splines and set them "big mesh" (lime skeleton for the
figure)
IMG: http://www.render.ru/forum/images/upload/911384.jpg
2. Create helix:
IMG: http://www.render.ru/forum/images/upload/911385.jpg
3. use patch deform to put splines cortage on helix:
IMG: http://www.render.ru/forum/images/upload/911387.jpg
4. Turn it Smiley
IMG: http://www.render.ru/forum/images/upload/911388.jpg
5. Enjoy.
So, I've wrote a program in Java, It reads XML and generates all
MaxScript code.
Each plain cortage gets own helix with only one coil.
Each cortage is placed on such helix.
Then helixes are sticked together.

I would like to do the same but without 3DMax and it's script language.

Please tell me, what do I have to learn to do pretty the same.


Re: Please help with concrete task
Reply #1 - Feb 20th, 2009, 5:39pm
 
i made something similar a while ago, just without your last rotate step... i reduced it alot maybe its a good point to start...

import processing.opengl.*;


Spot[]  spots = new Spot[1];

float distance =            10.0;                
float durchmesser=            5 ;              

void setup(){
 size(690,480,OPENGL);
 // size(1200,900,OPENGL);
 frameRate(55);
 background( 255);
 smooth();
 spots[0] = new Spot(width/2,height/2);
}

void draw(){
 background(255);
 randomSeed(0);
 



 spots[0].display();

}

class Spot{
 float x, y;
 int resolution;
 int start;
 int end;
 int helixRadius;

 Spot(float xpos, float ypos){
   x=xpos;
   y=ypos;

   resolution = 120;
   start = 0;
   end = 1480;
   helixRadius = 50;

 }

 /////////////////////////////////////DISPLAY CLASS///////////////////////////////////
 void display(){

  pushMatrix();

 translate(x,y-700,-2000);
 rotateZ(5);
 rotateY(-2);
 
 
 beginShape(QUAD_STRIP);

   for(int i=0;i<resolution;i++){
     float d=radians(map(i,0,resolution-1,start,end));

     fill(map(i,0,resolution,0,255));
     float xx = random(1.2,1.5);


     vertex(sin(d)*(helixRadius+i*durchmesser),cos(d)*(helixRadius+i*durchmesser),  i*distance);
     vertex(sin(d)*((helixRadius*(random(10 )))+i*durchmesser),cos(d)*((helixRadius*(random(10 )))+i*durchmesser),  i*distance);
   }
   endShape();

   popMatrix();
 }
}
Page Index Toggle Pages: 1