fttrigon.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  fttrigon.h                                                             */
00004 /*                                                                         */
00005 /*    FreeType trigonometric functions (specification).                    */
00006 /*                                                                         */
00007 /*  Copyright 2001, 2003, 2005, 2007 by                                    */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __FTTRIGON_H__
00020 #define __FTTRIGON_H__
00021 
00022 #include FT_FREETYPE_H
00023 
00024 #ifdef FREETYPE_H
00025 #error "freetype.h of FreeType 1 has been loaded!"
00026 #error "Please fix the directory search order for header files"
00027 #error "so that freetype.h of FreeType 2 is found first."
00028 #endif
00029 
00030 
00031 FT_BEGIN_HEADER
00032 
00033 
00034   /*************************************************************************/
00035   /*                                                                       */
00036   /* <Section>                                                             */
00037   /*   computations                                                        */
00038   /*                                                                       */
00039   /*************************************************************************/
00040 
00041 
00042   /*************************************************************************
00043    *
00044    * @type:
00045    *   FT_Angle
00046    *
00047    * @description:
00048    *   This type is used to model angle values in FreeType.  Note that the
00049    *   angle is a 16.16 fixed float value expressed in degrees.
00050    *
00051    */
00052   typedef FT_Fixed  FT_Angle;
00053 
00054 
00055   /*************************************************************************
00056    *
00057    * @macro:
00058    *   FT_ANGLE_PI
00059    *
00060    * @description:
00061    *   The angle pi expressed in @FT_Angle units.
00062    *
00063    */
00064 #define FT_ANGLE_PI  ( 180L << 16 )
00065 
00066 
00067   /*************************************************************************
00068    *
00069    * @macro:
00070    *   FT_ANGLE_2PI
00071    *
00072    * @description:
00073    *   The angle 2*pi expressed in @FT_Angle units.
00074    *
00075    */
00076 #define FT_ANGLE_2PI  ( FT_ANGLE_PI * 2 )
00077 
00078 
00079   /*************************************************************************
00080    *
00081    * @macro:
00082    *   FT_ANGLE_PI2
00083    *
00084    * @description:
00085    *   The angle pi/2 expressed in @FT_Angle units.
00086    *
00087    */
00088 #define FT_ANGLE_PI2  ( FT_ANGLE_PI / 2 )
00089 
00090 
00091   /*************************************************************************
00092    *
00093    * @macro:
00094    *   FT_ANGLE_PI4
00095    *
00096    * @description:
00097    *   The angle pi/4 expressed in @FT_Angle units.
00098    *
00099    */
00100 #define FT_ANGLE_PI4  ( FT_ANGLE_PI / 4 )
00101 
00102 
00103   /*************************************************************************
00104    *
00105    * @function:
00106    *   FT_Sin
00107    *
00108    * @description:
00109    *   Return the sinus of a given angle in fixed point format.
00110    *
00111    * @input:
00112    *   angle ::
00113    *     The input angle.
00114    *
00115    * @return:
00116    *   The sinus value.
00117    *
00118    * @note:
00119    *   If you need both the sinus and cosinus for a given angle, use the
00120    *   function @FT_Vector_Unit.
00121    *
00122    */
00123   FT_EXPORT( FT_Fixed )
00124   FT_Sin( FT_Angle  angle );
00125 
00126 
00127   /*************************************************************************
00128    *
00129    * @function:
00130    *   FT_Cos
00131    *
00132    * @description:
00133    *   Return the cosinus of a given angle in fixed point format.
00134    *
00135    * @input:
00136    *   angle ::
00137    *     The input angle.
00138    *
00139    * @return:
00140    *   The cosinus value.
00141    *
00142    * @note:
00143    *   If you need both the sinus and cosinus for a given angle, use the
00144    *   function @FT_Vector_Unit.
00145    *
00146    */
00147   FT_EXPORT( FT_Fixed )
00148   FT_Cos( FT_Angle  angle );
00149 
00150 
00151   /*************************************************************************
00152    *
00153    * @function:
00154    *   FT_Tan
00155    *
00156    * @description:
00157    *   Return the tangent of a given angle in fixed point format.
00158    *
00159    * @input:
00160    *   angle ::
00161    *     The input angle.
00162    *
00163    * @return:
00164    *   The tangent value.
00165    *
00166    */
00167   FT_EXPORT( FT_Fixed )
00168   FT_Tan( FT_Angle  angle );
00169 
00170 
00171   /*************************************************************************
00172    *
00173    * @function:
00174    *   FT_Atan2
00175    *
00176    * @description:
00177    *   Return the arc-tangent corresponding to a given vector (x,y) in
00178    *   the 2d plane.
00179    *
00180    * @input:
00181    *   x ::
00182    *     The horizontal vector coordinate.
00183    *
00184    *   y ::
00185    *     The vertical vector coordinate.
00186    *
00187    * @return:
00188    *   The arc-tangent value (i.e. angle).
00189    *
00190    */
00191   FT_EXPORT( FT_Angle )
00192   FT_Atan2( FT_Fixed  x,
00193             FT_Fixed  y );
00194 
00195 
00196   /*************************************************************************
00197    *
00198    * @function:
00199    *   FT_Angle_Diff
00200    *
00201    * @description:
00202    *   Return the difference between two angles.  The result is always
00203    *   constrained to the ]-PI..PI] interval.
00204    *
00205    * @input:
00206    *   angle1 ::
00207    *     First angle.
00208    *
00209    *   angle2 ::
00210    *     Second angle.
00211    *
00212    * @return:
00213    *   Constrained value of `value2-value1'.
00214    *
00215    */
00216   FT_EXPORT( FT_Angle )
00217   FT_Angle_Diff( FT_Angle  angle1,
00218                  FT_Angle  angle2 );
00219 
00220 
00221   /*************************************************************************
00222    *
00223    * @function:
00224    *   FT_Vector_Unit
00225    *
00226    * @description:
00227    *   Return the unit vector corresponding to a given angle.  After the
00228    *   call, the value of `vec.x' will be `sin(angle)', and the value of
00229    *   `vec.y' will be `cos(angle)'.
00230    *
00231    *   This function is useful to retrieve both the sinus and cosinus of a
00232    *   given angle quickly.
00233    *
00234    * @output:
00235    *   vec ::
00236    *     The address of target vector.
00237    *
00238    * @input:
00239    *   angle ::
00240    *     The address of angle.
00241    *
00242    */
00243   FT_EXPORT( void )
00244   FT_Vector_Unit( FT_Vector*  vec,
00245                   FT_Angle    angle );
00246 
00247 
00248   /*************************************************************************
00249    *
00250    * @function:
00251    *   FT_Vector_Rotate
00252    *
00253    * @description:
00254    *   Rotate a vector by a given angle.
00255    *
00256    * @inout:
00257    *   vec ::
00258    *     The address of target vector.
00259    *
00260    * @input:
00261    *   angle ::
00262    *     The address of angle.
00263    *
00264    */
00265   FT_EXPORT( void )
00266   FT_Vector_Rotate( FT_Vector*  vec,
00267                     FT_Angle    angle );
00268 
00269 
00270   /*************************************************************************
00271    *
00272    * @function:
00273    *   FT_Vector_Length
00274    *
00275    * @description:
00276    *   Return the length of a given vector.
00277    *
00278    * @input:
00279    *   vec ::
00280    *     The address of target vector.
00281    *
00282    * @return:
00283    *   The vector length, expressed in the same units that the original
00284    *   vector coordinates.
00285    *
00286    */
00287   FT_EXPORT( FT_Fixed )
00288   FT_Vector_Length( FT_Vector*  vec );
00289 
00290 
00291   /*************************************************************************
00292    *
00293    * @function:
00294    *   FT_Vector_Polarize
00295    *
00296    * @description:
00297    *   Compute both the length and angle of a given vector.
00298    *
00299    * @input:
00300    *   vec ::
00301    *     The address of source vector.
00302    *
00303    * @output:
00304    *   length ::
00305    *     The vector length.
00306    *
00307    *   angle ::
00308    *     The vector angle.
00309    *
00310    */
00311   FT_EXPORT( void )
00312   FT_Vector_Polarize( FT_Vector*  vec,
00313                       FT_Fixed   *length,
00314                       FT_Angle   *angle );
00315 
00316 
00317   /*************************************************************************
00318    *
00319    * @function:
00320    *   FT_Vector_From_Polar
00321    *
00322    * @description:
00323    *   Compute vector coordinates from a length and angle.
00324    *
00325    * @output:
00326    *   vec ::
00327    *     The address of source vector.
00328    *
00329    * @input:
00330    *   length ::
00331    *     The vector length.
00332    *
00333    *   angle ::
00334    *     The vector angle.
00335    *
00336    */
00337   FT_EXPORT( void )
00338   FT_Vector_From_Polar( FT_Vector*  vec,
00339                         FT_Fixed    length,
00340                         FT_Angle    angle );
00341 
00342   /* */
00343 
00344 
00345 FT_END_HEADER
00346 
00347 #endif /* __FTTRIGON_H__ */
00348 
00349 
00350 /* END */

Generated on Tue Jul 5 14:13:38 2011 for ROOT_528-00b_version by  doxygen 1.5.1