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 › Ribbon Trail.... I need some suggestions
Page Index Toggle Pages: 1
Ribbon Trail.... I need some suggestions (Read 510 times)
Ribbon Trail.... I need some suggestions
Apr 20th, 2007, 3:18pm
 
Hello everyone!

I need some smooth ribbon trail for a project and I can't find any good solution.
I want to transform a simple curve in a surface. I got an array with all my points(in 3D).
I'm using Daniel Shiffman Vector3D library for my points, and all I find to compute the necessary vertex is the cross product.I'm not so good at 3d mathematics and I think I need something else.
Here is my code for the ribbon:

 void render(){
   pushMatrix();
   fill(0,20);
   noStroke();
   int div = 1;
   Vector3D loc1 = (Vector3D) parts.get(0);
   for(int i=div; i<parts.size(); i+=div){
          Vector3D loc2 = (Vector3D) parts.get(i);
          Vector3D cross1 = loc1.cross(loc2);
          cross1.normalize();
          cross1.mult(20);
          beginShape();  
   vertex(loc1.x-cross1.x,loc1.y-cross1.y,loc1.z-cross1.z);
vertex(loc1.x+cross1.x,loc1.y+cross1.y,loc1.z+cross1.z);
vertex(loc2.x+cross1.x,loc2.y+cross1.y,loc2.z+cross1.z);
vertex(loc2.x-cross1.x,loc2.y-cross1.y,loc2.z-cross1.z);
          endShape();
          loc1 = loc2.copy();
     }
   popMatrix();
 }

"parts" is an ArrayList with all my Vector3D points.

Do someone have any good suggestion for me? an url where they explain the maths behind that or maybee even a solution? ;-)

Thanks in advance.

Cheers,
Simon.
Page Index Toggle Pages: 1