The BIG graph update
[rrdtool.git] / libraries / freetype-2.0.5 / include / freetype / fttrigon.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  fttrigon.h                                                             */
4 /*                                                                         */
5 /*    FreeType trigonometric functions (specification).                    */
6 /*                                                                         */
7 /*  Copyright 2001 by                                                      */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
10 /*  This file is part of the FreeType project, and may only be used,       */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #ifndef __FTTRIGON_H__
20 #define __FTTRIGON_H__
21
22 #include FT_FREETYPE_H
23
24
25 FT_BEGIN_HEADER
26
27
28   /*************************************************************************/
29   /*                                                                       */
30   /* @section:                                                             */
31   /*   computations                                                        */
32   /*                                                                       */
33   /*************************************************************************/
34
35
36   /*************************************************************************/
37   /*                                                                       */
38   /* @type:                                                                */
39   /*    FT_Angle                                                           */
40   /*                                                                       */
41   /* @description:                                                         */
42   /*    This type is used to model angle values in FreeType.  Note that    */
43   /*    the angle is a 16.16 fixed float value expressed in degrees.       */
44   /*                                                                       */
45   typedef FT_Fixed  FT_Angle;
46
47
48   /*************************************************************************/
49   /*                                                                       */
50   /* @macro:                                                               */
51   /*    FT_ANGLE_PI                                                        */
52   /*                                                                       */
53   /* @description:                                                         */
54   /*   The angle pi expressed in @FT_Angle units.                          */
55   /*                                                                       */
56 #define FT_ANGLE_PI  ( 180L << 16 )
57
58
59   /*************************************************************************/
60   /*                                                                       */
61   /* @macro:                                                               */
62   /*    FT_ANGLE_2PI                                                       */
63   /*                                                                       */
64   /* @description:                                                         */
65   /*    The angle 2*pi expressed in @FT_Angle units.                       */
66   /*                                                                       */
67 #define FT_ANGLE_2PI  ( FT_ANGLE_PI * 2 )
68
69
70   /*************************************************************************/
71   /*                                                                       */
72   /* @macro:                                                               */
73   /*    FT_ANGLE_PI2                                                       */
74   /*                                                                       */
75   /* @description:                                                         */
76   /*    The angle pi/2 expressed in @FT_Angle units.                       */
77   /*                                                                       */
78 #define FT_ANGLE_PI2  ( FT_ANGLE_PI / 2 )
79
80
81   /*************************************************************************/
82   /*                                                                       */
83   /* @macro:                                                               */
84   /*    FT_ANGLE_PI4                                                       */
85   /*                                                                       */
86   /* @description:                                                         */
87   /*    The angle pi/4 expressed in @FT_Angle units.                       */
88   /*                                                                       */
89 #define FT_ANGLE_PI4  ( FT_ANGLE_PI / 4 )
90
91
92   /*************************************************************************/
93   /*                                                                       */
94   /* @function:                                                            */
95   /*    FT_Sin                                                             */
96   /*                                                                       */
97   /* @description:                                                         */
98   /*    Return the sinus of a given angle in fixed point format.           */
99   /*                                                                       */
100   /* @input:                                                               */
101   /*    angle :: The input angle.                                          */
102   /*                                                                       */
103   /* @return:                                                              */
104   /*    The sinus value.                                                   */
105   /*                                                                       */
106   /* @note:                                                                */
107   /*    If you need both the sinus and cosinus for a given angle, use the  */
108   /*    function @FT_Vector_Unit.                                          */
109   /*                                                                       */
110   FT_EXPORT( FT_Fixed )
111   FT_Sin( FT_Angle  angle );
112
113
114   /*************************************************************************/
115   /*                                                                       */
116   /* @function:                                                            */
117   /*    FT_Cos                                                             */
118   /*                                                                       */
119   /* @description:                                                         */
120   /*    Return the cosinus of a given angle in fixed point format.         */
121   /*                                                                       */
122   /* @input:                                                               */
123   /*    angle :: The input angle.                                          */
124   /*                                                                       */
125   /* @return:                                                              */
126   /*    The cosinus value.                                                 */
127   /*                                                                       */
128   /* @note:                                                                */
129   /*    If you need both the sinus and cosinus for a given angle, use the  */
130   /*    function @FT_Vector_Unit.                                          */
131   /*                                                                       */
132   FT_EXPORT( FT_Fixed )
133   FT_Cos( FT_Angle  angle );
134
135
136   /*************************************************************************/
137   /*                                                                       */
138   /* @function:                                                            */
139   /*    FT_Tan                                                             */
140   /*                                                                       */
141   /* @description:                                                         */
142   /*    Return the tangent of a given angle in fixed point format.         */
143   /*                                                                       */
144   /* @input:                                                               */
145   /*    angle :: The input angle.                                          */
146   /*                                                                       */
147   /* @return:                                                              */
148   /*    The tangent value.                                                 */
149   /*                                                                       */
150   FT_EXPORT( FT_Fixed )
151   FT_Tan( FT_Angle  angle );
152
153
154   /*************************************************************************/
155   /*                                                                       */
156   /* @function:                                                            */
157   /*    FT_Atan2                                                           */
158   /*                                                                       */
159   /* @description:                                                         */
160   /*    Return the arc-tangent corresponding to a given vector (x,y) in    */
161   /*    the 2d plane.                                                      */
162   /*                                                                       */
163   /* @input:                                                               */
164   /*    x :: The horizontal vector coordinate.                             */
165   /*                                                                       */
166   /*    y :: The vertical vector coordinate.                               */
167   /*                                                                       */
168   /* @return:                                                              */
169   /*    The arc-tangent value (i.e. angle).                                */
170   /*                                                                       */
171   FT_EXPORT( FT_Angle )
172   FT_Atan2( FT_Fixed  x,
173             FT_Fixed  y );
174
175
176   /*************************************************************************/
177   /*                                                                       */
178   /* @function:                                                            */
179   /*    FT_Vector_Unit                                                     */
180   /*                                                                       */
181   /* @description:                                                         */
182   /*    Return the unit vector corresponding to a given angle.  After the  */
183   /*    call, the value of `vec.x' will be `sin(angle)', and the value of  */
184   /*    `vec.y' will be `cos(angle)'.                                      */
185   /*                                                                       */
186   /*    This function is useful to retrieve both the sinus and cosinus of  */
187   /*    a given angle quickly.                                             */
188   /*                                                                       */
189   /* @output:                                                              */
190   /*    vec   :: The address of target vector.                             */
191   /*                                                                       */
192   /* @input:                                                               */
193   /*    angle :: The address of angle.                                     */
194   /*                                                                       */
195   FT_EXPORT( void )
196   FT_Vector_Unit( FT_Vector*  vec,
197                   FT_Angle    angle );
198
199
200   /*************************************************************************/
201   /*                                                                       */
202   /* @function:                                                            */
203   /*    FT_Vector_Rotate                                                   */
204   /*                                                                       */
205   /* @description:                                                         */
206   /*    Rotate a vector by a given angle.                                  */
207   /*                                                                       */
208   /* @inout:                                                               */
209   /*    vec   :: The address of target vector.                             */
210   /*                                                                       */
211   /* @input:                                                               */
212   /*    angle :: The address of angle.                                     */
213   /*                                                                       */
214   FT_EXPORT( void )
215   FT_Vector_Rotate( FT_Vector*  vec,
216                     FT_Angle    angle );
217
218
219   /*************************************************************************/
220   /*                                                                       */
221   /* @function:                                                            */
222   /*   FT_Vector_Length                                                    */
223   /*                                                                       */
224   /* @description:                                                         */
225   /*   Return the length of a given vector.                                */
226   /*                                                                       */
227   /* @input:                                                               */
228   /*   vec :: The address of target vector.                                */
229   /*                                                                       */
230   /* @return:                                                              */
231   /*   The vector length, expressed in the same units that the original    */
232   /*   vector coordinates.                                                 */
233   /*                                                                       */
234   FT_EXPORT( FT_Fixed )
235   FT_Vector_Length( FT_Vector*  vec );
236
237
238   /*************************************************************************/
239   /*                                                                       */
240   /* @function:                                                            */
241   /*    FT_Vector_Normalize                                                */
242   /*                                                                       */
243   /* @description:                                                         */
244   /*    Normalize a given vector (i.e. compute the equivalent unit         */
245   /*    vector).                                                           */
246   /*                                                                       */
247   /* @inout:                                                               */
248   /*    vec :: The address of target vector.                               */
249   /*                                                                       */
250   FT_EXPORT( void )
251   FT_Vector_Normalize( FT_Vector*  vec );
252
253
254   /*************************************************************************/
255   /*                                                                       */
256   /* @function:                                                            */
257   /*    FT_Vector_Polarize                                                 */
258   /*                                                                       */
259   /* @description:                                                         */
260   /*    Compute both the length and angle of a given vector.               */
261   /*                                                                       */
262   /* @input:                                                               */
263   /*    vec    :: The address of source vector.                            */
264   /*                                                                       */
265   /* @output:                                                              */
266   /*    length :: The vector length.                                       */
267   /*    angle  :: The vector angle.                                        */
268   /*                                                                       */
269   FT_EXPORT( void )
270   FT_Vector_Polarize( FT_Vector*  vec,
271                       FT_Fixed   *length,
272                       FT_Angle   *angle );
273   /* */
274
275
276 FT_END_HEADER
277
278 #endif /* __FTTRIGON_H__ */
279
280
281 /* END */