1
/***************************************************************************/
5
/* FreeType trigonometric functions (specification). */
7
/* Copyright 2001, 2003, 2005, 2007 by */
8
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16
/***************************************************************************/
19
#ifndef __FTTRIGON_H__
20
#define __FTTRIGON_H__
22
#include FT_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."
34
/*************************************************************************/
39
/*************************************************************************/
42
/*************************************************************************
48
* This type is used to model angle values in FreeType. Note that the
49
* angle is a 16.16 fixed float value expressed in degrees.
52
typedef FT_Fixed FT_Angle;
55
/*************************************************************************
61
* The angle pi expressed in @FT_Angle units.
64
#define FT_ANGLE_PI ( 180L << 16 )
67
/*************************************************************************
73
* The angle 2*pi expressed in @FT_Angle units.
76
#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 )
79
/*************************************************************************
85
* The angle pi/2 expressed in @FT_Angle units.
88
#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 )
91
/*************************************************************************
97
* The angle pi/4 expressed in @FT_Angle units.
100
#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 )
103
/*************************************************************************
109
* Return the sinus of a given angle in fixed point format.
119
* If you need both the sinus and cosinus for a given angle, use the
120
* function @FT_Vector_Unit.
123
FT_EXPORT( FT_Fixed )
124
FT_Sin( FT_Angle angle );
127
/*************************************************************************
133
* Return the cosinus of a given angle in fixed point format.
143
* If you need both the sinus and cosinus for a given angle, use the
144
* function @FT_Vector_Unit.
147
FT_EXPORT( FT_Fixed )
148
FT_Cos( FT_Angle angle );
151
/*************************************************************************
157
* Return the tangent of a given angle in fixed point format.
167
FT_EXPORT( FT_Fixed )
168
FT_Tan( FT_Angle angle );
171
/*************************************************************************
177
* Return the arc-tangent corresponding to a given vector (x,y) in
182
* The horizontal vector coordinate.
185
* The vertical vector coordinate.
188
* The arc-tangent value (i.e. angle).
191
FT_EXPORT( FT_Angle )
192
FT_Atan2( FT_Fixed x,
196
/*************************************************************************
202
* Return the difference between two angles. The result is always
203
* constrained to the ]-PI..PI] interval.
213
* Constrained value of `value2-value1'.
216
FT_EXPORT( FT_Angle )
217
FT_Angle_Diff( FT_Angle angle1,
221
/*************************************************************************
227
* Return the unit vector corresponding to a given angle. After the
228
* call, the value of `vec.x' will be `sin(angle)', and the value of
229
* `vec.y' will be `cos(angle)'.
231
* This function is useful to retrieve both the sinus and cosinus of a
232
* given angle quickly.
236
* The address of target vector.
240
* The address of angle.
244
FT_Vector_Unit( FT_Vector* vec,
248
/*************************************************************************
254
* Rotate a vector by a given angle.
258
* The address of target vector.
262
* The address of angle.
266
FT_Vector_Rotate( FT_Vector* vec,
270
/*************************************************************************
276
* Return the length of a given vector.
280
* The address of target vector.
283
* The vector length, expressed in the same units that the original
284
* vector coordinates.
287
FT_EXPORT( FT_Fixed )
288
FT_Vector_Length( FT_Vector* vec );
291
/*************************************************************************
297
* Compute both the length and angle of a given vector.
301
* The address of source vector.
312
FT_Vector_Polarize( FT_Vector* vec,
317
/*************************************************************************
320
* FT_Vector_From_Polar
323
* Compute vector coordinates from a length and angle.
327
* The address of source vector.
338
FT_Vector_From_Polar( FT_Vector* vec,
347
#endif /* __FTTRIGON_H__ */