Notifications
Clear all

[Closed] How to create a linear wave function

Creating a sine function is pretty basic, but how can I create a similar function except linear in maxscript?

I’ve managed to create such waveform in Desmos graph calculator https://www.desmos.com/calculator/oqgzjzz6r0
but I can’t figure out how to translate it into maxscript properly.

Anyone know how?

4 Replies
(
	delete objects

	sp = splineshape()
	addnewspline sp
	for a = -360 to 360 by 180 do addknot sp 1 #corner #line [a, 0, (cos a)*90]
	 
	updateshape sp
)



amplitude and axis adjust yourself

 lo1
0.5 + (asin(cos(x*2))/180
1 Reply
(@swahn)
Joined: 10 months ago

Posts: 0

Yes, that’s what I was looking for!

0.5 + (asin(cos(x)))/180 is the exact formula I need.
Big thanks!

 lo1

Bonus, without any trig:

2 * abs ((mod (abs x) 180.) / 180. - .5)