angled.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  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 Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------


immutable class ANGLED < $ANGLES{FLTD,CPXD}, $BINARY , $ORDERED{ANGLED},

immutable class ANGLED < $ANGLES{FLTD,CPXD}, $BINARY , $ORDERED{ANGLED}, $IS_EQ is -- This class embodies the concept of a geometric angle. It consists -- primarily of creation/conversion and arithmetic operations. -- -- Angles are represented internally as normalised values in radians -- in the range -p1 to pi. -- -- NOTE This class was originally part of the standard Sather distribution -- approximate number class FLTD. Separated out because of the -- numeric and angular domain being different conceptually. -- Version 1.2 Mar 99. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 9 Jan 97 kh Original extracted from FLT. -- 11 Jan 99 kh added $BINARY sub-typing -- 25 Mar 99 kh factored out non-built-ins! include ANGLE{FLTD,CPXD} ; private const Half_Circle : FLTD := 180.0d ; private const Two_Pi : FLTD := FLTD::pi * 2.0d ; private const asize : CARD := 64 ; ----FUDGE for asize! private priv_radians( val : FLTD ) : SAME is -- This is the creation operation where the numeric value is given in -- radians. Built-in to this implementation. builtin FLTD_ANGLED end ; -- Creation routines from trigonometric values acos( val : FLTD ) : SAME is -- This routine creates an angle given the cosine argument. builtin ACOS_ANGLED end ; asin( val : FLTD ) : SAME is -- This routine creates an angle given the sine argument. builtin ASIN_ANGLED end ; atan( val : FLTD ) : SAME is -- This routine creates an angle given the tangent argument. builtin ATAN_ANGLED end ; atan2( denominator, divisor : FLTD ) : SAME is -- This routine creates an angle whose arctangent is the result of -- dividing denominator by divisor. builtin ATAN2_ANGLED end ; radians : FLTD is -- This routine returns the number which is the normalised value of -- self in radians. builtin ANGLED_FLTD end ; sin : FLTD is -- This routine creates a number which corresponds to the sine of the -- angle self. builtin ANGLED_FLTD_SIN end ; cos : FLTD is -- This routine creates a number which corresponds to the cosine of -- the angle self. builtin ANGLED_FLTD_COS end ; tan : FLTD is -- This routine creates a number which corresponds to the tangent of -- the angle self. builtin ANGLED_FLTD_TAN end ; sincos( out sine : FLTD, out cosine : FLTD ) is -- This routine simultaneously creates numbers which correspond to -- the sine and cosine of the angle self. This is more efficient than -- computing the two separately where both are needed. -- TEMPORARY(?) FUDGE sine := sin ; cosine := cos -- builtin ANGLED_FLTD_SINCOS end ; end ; -- ANGLED