[Closed] Sawtooth wave form
Hi
here it is my try for , Sawtooth wave form
But it is not correct or accurate
Waht’s the better way?
delete objects
obj = teapot radius:20
wave_amplitude = 10
wave_width = 10
frequency = 10
x_position = 0
obj.showTrajectory = on
for i = 1 to 800 do
(
animate on
(
at time i
(
y_position = atan (tan(i*frequency))
x_position += wave_width
obj.pos.y = y_position
obj.pos.x = x_position
)
)
)
hi i’m no expert but i’d go with a path follow.
here is a dirty example i patched up from the maxscript reference
i left also the comments of the reference
fn genpath amplitude:10 frequency:50 sawcycles:10 =
(
amp = amplitude
freq = frequency
freq_add = copy freq
cycles = sawcycles
local sp = splineShape()
addnewSpline sp
addKnot sp 1 #corner #line [0,0,0]
for i=1 to cycles do (
addKnot sp 1 #corner #line [freq,amp,0]
addKnot sp 1 #corner #line [freq,0,0]
freq += freq_add
)
updateShape sp
select sp
theObj=cone radius1:2 radius2:0 height: 5-- create object to travel on path
theObj.pos.controller=path follow:true -- assign path controller to object
PosCont=theObj.pos.controller -- grab the path controller
PosCont.path=sp -- set path to shape node
PosCont.axis=2 -- point local Z axis along path
animate on -- create keys at&ldots;
(
at time 100 PosCont.percent=100 -- frame 100 - 95% along path
)
)
genpath frequency:40 sawcycles:5
That answer is so wrong that makes it perfect respond for subject!
Why not using program other way around, creating functions and shapes by creating couple simple frame points.
Taking advantage of time dimension…
ok, i maybe did not understand the thing, can you please explain me yours?
you can use the same function of the op to draw the sawtooth with a spline, it was just simpler for me to do it in this way. so i don’t get it, he is actually baging transformation of the objects at time and the thing is the same here, i really dont get your point