View Single Post
Old 3rd April 2006, 01:02   #245
StevenRoy
Senior Member
 
StevenRoy's Avatar
 
Join Date: Jun 2005
Location: USA
Posts: 129
Send a message via ICQ to StevenRoy Send a message via AIM to StevenRoy
Quote:
Originally posted by Warrior of the Light
Triangular wave for an SSC:

code:
x=i*2-1;
y=asin(sin(i*$pi*2))/asin(1);

Sorry, but I just can't ignore that ugliness anymore. Here, try this instead:
code:
x=i*2-1;
ii=i-.25;
y=abs((ii-floor(ii))*2-1)*2-1;

There. Thank goodness for the floor() function!
StevenRoy is offline   Reply With Quote