/** * @(#) $RCSfile: TrigonometryTableLookup.as,v $ $Revision: 1.4 $ $Date: 2003/01/29 16:40:19 $ * * Copyright 2003 Orgdot AS. All Rights Reserved. * http://dev.swfit.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * This script will return a positive value for an angle (in degrees) based on * input values for cos_val and sin_val (that may be larger than 1). See * TrigonometryTable.as for details on the atan values. * * * @author Olaf Havnes * @version $Revision: 1.4 $ $Date: 2003/01/29 16:40:19 $ * @since SWFIT1.0 */ atan = 0; if (cos_val < 0) { if (sin_val < 0) { if (cos_val < sin_val) { t00 = int (100 * sin_val / cos_val); atan = 180 + eval ("/:ATAN_" add t00); } else { t00 = int (100 * cos_val / sin_val); atan = 180 + (90 - eval ("/:ATAN_" add t00)); } } else if (sin_val > 0) { cos_val = - cos_val; if (cos_val < sin_val) { t00 = int (100 * cos_val / sin_val); atan = 90 + eval ("/:ATAN_" add t00); } else { t00 = int (100 * sin_val / cos_val); atan = 90 + (90 - eval ("/:ATAN_" add t00)); } } else atan = 180; } else if (cos_val > 0) { if (sin_val > 0) { if (cos_val > sin_val) { t00 = int (100 * sin_val / cos_val); atan = eval ("/:ATAN_" add t00); } else { t00 = int (100 * cos_val / sin_val); atan = 90 - eval ("/:ATAN_" add t00); } } else if (sin_val < 0) { sin_val = - sin_val; if (cos_val < sin_val) { t00 = int (100 * cos_val / sin_val); atan = 270 + eval ("/:ATAN_" add t00); } else { t00 = int (100 * sin_val / cos_val); atan = 270 + (90 - eval ("/:ATAN_" add t00)); } } else atan = 0; } else { if (sin_val < 0) atan = 270; else if (sin_val > 0) atan = 90; }