// Last edited on 2020-11-27 17:49:00 by jstolfi // Macros that define a random motion of a tentacle. #macro tentacle_random_key_bezier_point_positions(NQ, ip, A0,Z3, mP, rgen) // Returns array of {NQ} elements with random positions of // Bezier control point {ip} of a non-grasping tentacle // each key frame. // The last element is equal to the first one. // {ip} = number of the Bezier point, 0 to 9. // {A0} = coords of base of tentacle (assumed fixed). // {Z3} = mean coords of tip of tentacle. // {mP} = max point perturbation from straight line {A0:Z3}. // {rgen} = random number generator. #local P = array[NQ]; #local kq = 0; #while (kq < NQ-1) #local P[kq] = interpolate1(ip/9, 0,1, A0,Z3) + (ip/9)*mP*ranvec(rgen); #local kq = kq + 1; #end #local P[NQ-1] = P[0]; P #end