~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/include/freetype/fttrigon.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************/
 
2
/*                                                                         */
 
3
/*  fttrigon.h                                                             */
 
4
/*                                                                         */
 
5
/*    FreeType trigonometric functions (specification).                    */
 
6
/*                                                                         */
 
7
/*  Copyright 2001, 2003 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
#ifdef FREETYPE_H
 
25
#error "freetype.h of FreeType 1 has been loaded!"
 
26
#error "Please fix the directory search order for header files"
 
27
#error "so that freetype.h of FreeType 2 is found first."
 
28
#endif
 
29
 
 
30
 
 
31
FT_BEGIN_HEADER
 
32
 
 
33
 
 
34
  /*************************************************************************/
 
35
  /*                                                                       */
 
36
  /* @section:                                                             */
 
37
  /*   computations                                                        */
 
38
  /*                                                                       */
 
39
  /*************************************************************************/
 
40
 
 
41
 
 
42
  /*************************************************************************/
 
43
  /*                                                                       */
 
44
  /* @type:                                                                */
 
45
  /*    FT_Angle                                                           */
 
46
  /*                                                                       */
 
47
  /* @description:                                                         */
 
48
  /*    This type is used to model angle values in FreeType.  Note that    */
 
49
  /*    the angle is a 16.16 fixed float value expressed in degrees.       */
 
50
  /*                                                                       */
 
51
  typedef FT_Fixed  FT_Angle;
 
52
 
 
53
 
 
54
  /*************************************************************************/
 
55
  /*                                                                       */
 
56
  /* @macro:                                                               */
 
57
  /*    FT_ANGLE_PI                                                        */
 
58
  /*                                                                       */
 
59
  /* @description:                                                         */
 
60
  /*   The angle pi expressed in @FT_Angle units.                          */
 
61
  /*                                                                       */
 
62
#define FT_ANGLE_PI  ( 180L << 16 )
 
63
 
 
64
 
 
65
  /*************************************************************************/
 
66
  /*                                                                       */
 
67
  /* @macro:                                                               */
 
68
  /*    FT_ANGLE_2PI                                                       */
 
69
  /*                                                                       */
 
70
  /* @description:                                                         */
 
71
  /*    The angle 2*pi expressed in @FT_Angle units.                       */
 
72
  /*                                                                       */
 
73
#define FT_ANGLE_2PI  ( FT_ANGLE_PI * 2 )
 
74
 
 
75
 
 
76
  /*************************************************************************/
 
77
  /*                                                                       */
 
78
  /* @macro:                                                               */
 
79
  /*    FT_ANGLE_PI2                                                       */
 
80
  /*                                                                       */
 
81
  /* @description:                                                         */
 
82
  /*    The angle pi/2 expressed in @FT_Angle units.                       */
 
83
  /*                                                                       */
 
84
#define FT_ANGLE_PI2  ( FT_ANGLE_PI / 2 )
 
85
 
 
86
 
 
87
  /*************************************************************************/
 
88
  /*                                                                       */
 
89
  /* @macro:                                                               */
 
90
  /*    FT_ANGLE_PI4                                                       */
 
91
  /*                                                                       */
 
92
  /* @description:                                                         */
 
93
  /*    The angle pi/4 expressed in @FT_Angle units.                       */
 
94
  /*                                                                       */
 
95
#define FT_ANGLE_PI4  ( FT_ANGLE_PI / 4 )
 
96
 
 
97
 
 
98
  /*************************************************************************/
 
99
  /*                                                                       */
 
100
  /* @function:                                                            */
 
101
  /*    FT_Sin                                                             */
 
102
  /*                                                                       */
 
103
  /* @description:                                                         */
 
104
  /*    Return the sinus of a given angle in fixed point format.           */
 
105
  /*                                                                       */
 
106
  /* @input:                                                               */
 
107
  /*    angle :: The input angle.                                          */
 
108
  /*                                                                       */
 
109
  /* @return:                                                              */
 
110
  /*    The sinus value.                                                   */
 
111
  /*                                                                       */
 
112
  /* @note:                                                                */
 
113
  /*    If you need both the sinus and cosinus for a given angle, use the  */
 
114
  /*    function @FT_Vector_Unit.                                          */
 
115
  /*                                                                       */
 
116
  FT_EXPORT( FT_Fixed )
 
117
  FT_Sin( FT_Angle  angle );
 
118
 
 
119
 
 
120
  /*************************************************************************/
 
121
  /*                                                                       */
 
122
  /* @function:                                                            */
 
123
  /*    FT_Cos                                                             */
 
124
  /*                                                                       */
 
125
  /* @description:                                                         */
 
126
  /*    Return the cosinus of a given angle in fixed point format.         */
 
127
  /*                                                                       */
 
128
  /* @input:                                                               */
 
129
  /*    angle :: The input angle.                                          */
 
130
  /*                                                                       */
 
131
  /* @return:                                                              */
 
132
  /*    The cosinus value.                                                 */
 
133
  /*                                                                       */
 
134
  /* @note:                                                                */
 
135
  /*    If you need both the sinus and cosinus for a given angle, use the  */
 
136
  /*    function @FT_Vector_Unit.                                          */
 
137
  /*                                                                       */
 
138
  FT_EXPORT( FT_Fixed )
 
139
  FT_Cos( FT_Angle  angle );
 
140
 
 
141
 
 
142
  /*************************************************************************/
 
143
  /*                                                                       */
 
144
  /* @function:                                                            */
 
145
  /*    FT_Tan                                                             */
 
146
  /*                                                                       */
 
147
  /* @description:                                                         */
 
148
  /*    Return the tangent of a given angle in fixed point format.         */
 
149
  /*                                                                       */
 
150
  /* @input:                                                               */
 
151
  /*    angle :: The input angle.                                          */
 
152
  /*                                                                       */
 
153
  /* @return:                                                              */
 
154
  /*    The tangent value.                                                 */
 
155
  /*                                                                       */
 
156
  FT_EXPORT( FT_Fixed )
 
157
  FT_Tan( FT_Angle  angle );
 
158
 
 
159
 
 
160
  /*************************************************************************/
 
161
  /*                                                                       */
 
162
  /* @function:                                                            */
 
163
  /*    FT_Atan2                                                           */
 
164
  /*                                                                       */
 
165
  /* @description:                                                         */
 
166
  /*    Return the arc-tangent corresponding to a given vector (x,y) in    */
 
167
  /*    the 2d plane.                                                      */
 
168
  /*                                                                       */
 
169
  /* @input:                                                               */
 
170
  /*    x :: The horizontal vector coordinate.                             */
 
171
  /*                                                                       */
 
172
  /*    y :: The vertical vector coordinate.                               */
 
173
  /*                                                                       */
 
174
  /* @return:                                                              */
 
175
  /*    The arc-tangent value (i.e. angle).                                */
 
176
  /*                                                                       */
 
177
  FT_EXPORT( FT_Angle )
 
178
  FT_Atan2( FT_Fixed  x,
 
179
            FT_Fixed  y );
 
180
 
 
181
 
 
182
  /*************************************************************************/
 
183
  /*                                                                       */
 
184
  /* @function:                                                            */
 
185
  /*    FT_Angle_Diff                                                      */
 
186
  /*                                                                       */
 
187
  /* @description:                                                         */
 
188
  /*    Return the difference between two angles.  The result is always    */
 
189
  /*    constrained to the ]-PI..PI] interval.                             */
 
190
  /*                                                                       */
 
191
  /* @input:                                                               */
 
192
  /*    angle1 :: First angle.                                             */
 
193
  /*                                                                       */
 
194
  /*    angle2 :: Second angle.                                            */
 
195
  /*                                                                       */
 
196
  /* @return:                                                              */
 
197
  /*    Contrainted value of `value2-value1'.                              */
 
198
  /*                                                                       */
 
199
  FT_EXPORT( FT_Angle )
 
200
  FT_Angle_Diff( FT_Angle  angle1,
 
201
                 FT_Angle  angle2 );
 
202
 
 
203
 
 
204
  /*************************************************************************/
 
205
  /*                                                                       */
 
206
  /* @function:                                                            */
 
207
  /*    FT_Vector_Unit                                                     */
 
208
  /*                                                                       */
 
209
  /* @description:                                                         */
 
210
  /*    Return the unit vector corresponding to a given angle.  After the  */
 
211
  /*    call, the value of `vec.x' will be `sin(angle)', and the value of  */
 
212
  /*    `vec.y' will be `cos(angle)'.                                      */
 
213
  /*                                                                       */
 
214
  /*    This function is useful to retrieve both the sinus and cosinus of  */
 
215
  /*    a given angle quickly.                                             */
 
216
  /*                                                                       */
 
217
  /* @output:                                                              */
 
218
  /*    vec   :: The address of target vector.                             */
 
219
  /*                                                                       */
 
220
  /* @input:                                                               */
 
221
  /*    angle :: The address of angle.                                     */
 
222
  /*                                                                       */
 
223
  FT_EXPORT( void )
 
224
  FT_Vector_Unit( FT_Vector*  vec,
 
225
                  FT_Angle    angle );
 
226
 
 
227
 
 
228
  /*************************************************************************/
 
229
  /*                                                                       */
 
230
  /* @function:                                                            */
 
231
  /*    FT_Vector_Rotate                                                   */
 
232
  /*                                                                       */
 
233
  /* @description:                                                         */
 
234
  /*    Rotate a vector by a given angle.                                  */
 
235
  /*                                                                       */
 
236
  /* @inout:                                                               */
 
237
  /*    vec   :: The address of target vector.                             */
 
238
  /*                                                                       */
 
239
  /* @input:                                                               */
 
240
  /*    angle :: The address of angle.                                     */
 
241
  /*                                                                       */
 
242
  FT_EXPORT( void )
 
243
  FT_Vector_Rotate( FT_Vector*  vec,
 
244
                    FT_Angle    angle );
 
245
 
 
246
 
 
247
  /*************************************************************************/
 
248
  /*                                                                       */
 
249
  /* @function:                                                            */
 
250
  /*   FT_Vector_Length                                                    */
 
251
  /*                                                                       */
 
252
  /* @description:                                                         */
 
253
  /*   Return the length of a given vector.                                */
 
254
  /*                                                                       */
 
255
  /* @input:                                                               */
 
256
  /*   vec :: The address of target vector.                                */
 
257
  /*                                                                       */
 
258
  /* @return:                                                              */
 
259
  /*   The vector length, expressed in the same units that the original    */
 
260
  /*   vector coordinates.                                                 */
 
261
  /*                                                                       */
 
262
  FT_EXPORT( FT_Fixed )
 
263
  FT_Vector_Length( FT_Vector*  vec );
 
264
 
 
265
 
 
266
  /*************************************************************************/
 
267
  /*                                                                       */
 
268
  /* @function:                                                            */
 
269
  /*    FT_Vector_Polarize                                                 */
 
270
  /*                                                                       */
 
271
  /* @description:                                                         */
 
272
  /*    Compute both the length and angle of a given vector.               */
 
273
  /*                                                                       */
 
274
  /* @input:                                                               */
 
275
  /*    vec    :: The address of source vector.                            */
 
276
  /*                                                                       */
 
277
  /* @output:                                                              */
 
278
  /*    length :: The vector length.                                       */
 
279
  /*    angle  :: The vector angle.                                        */
 
280
  /*                                                                       */
 
281
  FT_EXPORT( void )
 
282
  FT_Vector_Polarize( FT_Vector*  vec,
 
283
                      FT_Fixed   *length,
 
284
                      FT_Angle   *angle );
 
285
 
 
286
 
 
287
  /*************************************************************************/
 
288
  /*                                                                       */
 
289
  /* @function:                                                            */
 
290
  /*    FT_Vector_From_Polar                                               */
 
291
  /*                                                                       */
 
292
  /* @description:                                                         */
 
293
  /*    Compute vector coordinates from a length and angle.                */
 
294
  /*                                                                       */
 
295
  /* @output:                                                              */
 
296
  /*    vec    :: The address of source vector.                            */
 
297
  /*                                                                       */
 
298
  /* @input:                                                               */
 
299
  /*    length :: The vector length.                                       */
 
300
  /*    angle  :: The vector angle.                                        */
 
301
  /*                                                                       */
 
302
  FT_EXPORT( void )
 
303
  FT_Vector_From_Polar( FT_Vector*  vec,
 
304
                        FT_Fixed    length,
 
305
                        FT_Angle    angle );
 
306
 
 
307
  /* */
 
308
 
 
309
 
 
310
FT_END_HEADER
 
311
 
 
312
#endif /* __FTTRIGON_H__ */
 
313
 
 
314
 
 
315
/* END */