angle = theta2 - theta1; helical_length = hypot(angle * radius, axis_len); thelix = fabs(helical_length / ini_maxvel); helix_angle = atan2((radius * angle),axis_len); radial_vel = sin(helix_angle)*(helical_length/thelix); //find the centripetal acceleration of the helix centripetal_acc = radial_vel * radial_vel / radius; acc = MIN(acc, centripetal_acc);