PDA

View Full Version : Final Summary: Calculation of 2D Angles ('CAST' problem)

Dr. Chris Kirtley
01-03-2003, 02:46 AM
Happy new year to all.

Before I forget, I want to thank everyone who replied about the 2D angle
calculation problem. I have collated all the responses here:

http://guardian.curtin.edu.au/cga/faq/2Dangles.html

With the risk of offending everyone else, I am going to give my prize to
Zia Hasan, who came up with the following very simple algorithm:

IF x not equal to zero THEN angle = ATN(y/x) ELSE angle = SGN(y) * pi /
2
IF x < 0 THEN angle = angle + pi
IF angle < 0 THEN angle = angle +2*pi

I have checked this out for angles from 0 to 315 in steps of 45 degrees
http://guardian.curtin.edu.au/cga/faq/2Dangles.xls

As you can see, it works nicely. This might be a nice addition to the
ISB Software Archive.

Thanks again to everyone, and especially to Zia!

Chris
--
Dr. Chris Kirtley MD PhD
Associate Professor
Dept. of Biomedical Engineering
Catholic University of America
620 Michigan Ave NE, Washington, DC 20064
Tel. 202-319-6247, fax 202-319-4287
Email: kirtley@cua.edu
http://engineering.cua.edu/biomedical/faculty/kirtley

---------------------------------------------------------------
To unsubscribe send SIGNOFF BIOMCH-L to LISTSERV@nic.surfnet.nl
For information and archives: http://isb.ri.ccf.org/biomch-l
---------------------------------------------------------------