FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   Helix Example
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Helix Example  (Read 388 times)
fabsina

Email
Helix Example
« on: May 31st, 2004, 11:51pm »

Hey!
 
I'm working with the Helix Typography Example of the Example Section and I don't really catch on some parts of the code responsible for moving the helix. What exactly is the offset value used for? I skippede the whole scrollbar-part and just want to make helixes move up and down and make them turn back at a certain point. I tried to use the offset value to control that but it doesn't seem to be the right parameter to use. I guess there is no documented version of this code available, is there? Do you have any advice?
 
m.
 
arielm

WWW
Re: Helix Example
« Reply #1 on: Jun 1st, 2004, 11:36am »

used to be friend with them (the helices!)
 
the good news with them is that they are linear (i.e. it's possible to predict the xyz location of any point, given a distance), unlike sinewaves or bezier curves...
 
all this makes continous movement (or writing) on helices relatively simple.
 
what you need to trace a given helix point at distance D is like:
 
Code:
l = TWO_PI * turns;
L = PI * turns * (r1 + r2);
dz = h / l;
 
if (conical)
{
  r = sqrt(r1 * r1 + 2 * dr * D);
  d = (r - r1) / dr;
}
else
{
  d = D / r;
}
 
point(x - sin(d) * r, y + cos(d) * r, z + d * dz);

where:
 
x,y,z are the center point of the helix
h is the total height
turns is... the number of turns
r1,r2 are the starting/ending radii
 
the "conical" boolean value is here to avoid division-by-zero problems when an helix has a cylindrical shape (r1 = r2), it is computed this way:
 
conical = (abs(r1 - r2) > 0.5);
 
 
anyway, the Helix Typography example is not the simplier, you may be interested by these ones first:
 
http://www.chronotext.org/bits/014/
 
http://www.chronotext.org/bits/015/
 
http://www.chronotext.org/bits/016/
 
http://www.chronotext.org/bits/025/
 
a+
 

Ariel Malka | www.chronotext.org
fabsina

Email
Re: Helix Example
« Reply #2 on: Jun 2nd, 2004, 12:22pm »

Thanks! I think I have them pretty much under control now!
 
Martina
 
Pages: 1 

« Previous topic | Next topic »