big10p #1 Thanks b32, but that looks pretty complicated - lots of If tests, etc. Isn't there a way to do this using pure maths on vectors? The original text I posted seems to say there is.