That's quite hard. You basically want to find a tangent to a given surface, right? Well, the solution is to find two points close together on the surface, and use them, plus some trig, to find the angle.
Offline
Hardmath's right. This is very hard to achieve. There is, however, a method of switching to a 1px costume and pointing in direction 0 delete all of vals, repeat 360 move 1 step, if touching (edge) add [1] to [vals v], move -1 steps, turn right 1 degree
You'll need to put that script after repeat 360 360 times in a row O.O
Then, it's all trig from there.
Offline
Well, depending on the accuracy, you could make do in 20-ish repetitions.
Offline