W3C home > Mailing lists > Public > www-svg@w3.org > April 2001

angle between 2 vectors ..

From: Stefan Goessner <goessner@mecxpert.de>
Date: Fri, 27 Apr 2001 14:38:58 +0200
Message-ID: <002101c0cf17$0ad061c0$e91ee23e@user>
To: <www-svg@w3.org>
I was searching for a parameterized equation for elliptical arcs and .. quite happy to find it in a useful form in the spec (Appendix F.6 Eq. F.6.3.1).

On the next page there I became aware of a formula to determine the angle between two vectors u and v (F.6.5.4).
To implement this we need 4 calls of math functions: 
1 x acos()
2 x abs()
1 x sign()

I usually implement this in a somewhat other way, via

teta = atan2(ux*vy - uy*vx, ux*vx + uy*vy);

wich yields a teta in the range of  -pi/2 < teta < pi/2

with no need to care for the sign or any other pre- or postcalculations and one single math function.

are there any arguments against that ?

--
stefan goessner
Received on Friday, 27 April 2001 08:36:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:49 GMT