# Wave that approaches triangle from sine?

This topic is 3789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to make a curve that approaches a triangle wave from a sinus wave. Does anybody know some fast / convenient way to calculate this? The curve should look like a sine wave raised to a number greater than 1 but with more “linear” transition from lowest to highest value. Like the sketch below but symmetric :) Thanks

##### Share on other sites
You can get something like that if you take an ordinary triangle wave and smooth it out using quadratic/cubic/quintic/whatever interpolation.

If you happen to own a copy of GPU Gems 3, there's ready made shader code with cubic interpolation in chapter 16. It uses x*x*(3.0 - 2.0*x) for that matter.

##### Share on other sites
You can take a Fourier Series of an appropriate function, for example x or |x|. Look at this for a good example. Theres also an approximation here

##### Share on other sites
You could take a weighted average of a sine wave and a similar triangle wave. Something like t*sine + (1-t)*triangle for 0<t<1 .

1. 1
2. 2
Rutin
24
3. 3
JoeJ
19
4. 4
5. 5
gaxio
13

• 17
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631729
• Total Posts
3001918
×