vrshoot
diff libs/ft2static/freetype/fttrigon.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ft2static/freetype/fttrigon.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,350 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* fttrigon.h */ 1.7 +/* */ 1.8 +/* FreeType trigonometric functions (specification). */ 1.9 +/* */ 1.10 +/* Copyright 2001, 2003, 2005, 2007 by */ 1.11 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.12 +/* */ 1.13 +/* This file is part of the FreeType project, and may only be used, */ 1.14 +/* modified, and distributed under the terms of the FreeType project */ 1.15 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.16 +/* this file you indicate that you have read the license and */ 1.17 +/* understand and accept it fully. */ 1.18 +/* */ 1.19 +/***************************************************************************/ 1.20 + 1.21 + 1.22 +#ifndef __FTTRIGON_H__ 1.23 +#define __FTTRIGON_H__ 1.24 + 1.25 +#include FT_FREETYPE_H 1.26 + 1.27 +#ifdef FREETYPE_H 1.28 +#error "freetype.h of FreeType 1 has been loaded!" 1.29 +#error "Please fix the directory search order for header files" 1.30 +#error "so that freetype.h of FreeType 2 is found first." 1.31 +#endif 1.32 + 1.33 + 1.34 +FT_BEGIN_HEADER 1.35 + 1.36 + 1.37 + /*************************************************************************/ 1.38 + /* */ 1.39 + /* <Section> */ 1.40 + /* computations */ 1.41 + /* */ 1.42 + /*************************************************************************/ 1.43 + 1.44 + 1.45 + /************************************************************************* 1.46 + * 1.47 + * @type: 1.48 + * FT_Angle 1.49 + * 1.50 + * @description: 1.51 + * This type is used to model angle values in FreeType. Note that the 1.52 + * angle is a 16.16 fixed float value expressed in degrees. 1.53 + * 1.54 + */ 1.55 + typedef FT_Fixed FT_Angle; 1.56 + 1.57 + 1.58 + /************************************************************************* 1.59 + * 1.60 + * @macro: 1.61 + * FT_ANGLE_PI 1.62 + * 1.63 + * @description: 1.64 + * The angle pi expressed in @FT_Angle units. 1.65 + * 1.66 + */ 1.67 +#define FT_ANGLE_PI ( 180L << 16 ) 1.68 + 1.69 + 1.70 + /************************************************************************* 1.71 + * 1.72 + * @macro: 1.73 + * FT_ANGLE_2PI 1.74 + * 1.75 + * @description: 1.76 + * The angle 2*pi expressed in @FT_Angle units. 1.77 + * 1.78 + */ 1.79 +#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) 1.80 + 1.81 + 1.82 + /************************************************************************* 1.83 + * 1.84 + * @macro: 1.85 + * FT_ANGLE_PI2 1.86 + * 1.87 + * @description: 1.88 + * The angle pi/2 expressed in @FT_Angle units. 1.89 + * 1.90 + */ 1.91 +#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) 1.92 + 1.93 + 1.94 + /************************************************************************* 1.95 + * 1.96 + * @macro: 1.97 + * FT_ANGLE_PI4 1.98 + * 1.99 + * @description: 1.100 + * The angle pi/4 expressed in @FT_Angle units. 1.101 + * 1.102 + */ 1.103 +#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) 1.104 + 1.105 + 1.106 + /************************************************************************* 1.107 + * 1.108 + * @function: 1.109 + * FT_Sin 1.110 + * 1.111 + * @description: 1.112 + * Return the sinus of a given angle in fixed point format. 1.113 + * 1.114 + * @input: 1.115 + * angle :: 1.116 + * The input angle. 1.117 + * 1.118 + * @return: 1.119 + * The sinus value. 1.120 + * 1.121 + * @note: 1.122 + * If you need both the sinus and cosinus for a given angle, use the 1.123 + * function @FT_Vector_Unit. 1.124 + * 1.125 + */ 1.126 + FT_EXPORT( FT_Fixed ) 1.127 + FT_Sin( FT_Angle angle ); 1.128 + 1.129 + 1.130 + /************************************************************************* 1.131 + * 1.132 + * @function: 1.133 + * FT_Cos 1.134 + * 1.135 + * @description: 1.136 + * Return the cosinus of a given angle in fixed point format. 1.137 + * 1.138 + * @input: 1.139 + * angle :: 1.140 + * The input angle. 1.141 + * 1.142 + * @return: 1.143 + * The cosinus value. 1.144 + * 1.145 + * @note: 1.146 + * If you need both the sinus and cosinus for a given angle, use the 1.147 + * function @FT_Vector_Unit. 1.148 + * 1.149 + */ 1.150 + FT_EXPORT( FT_Fixed ) 1.151 + FT_Cos( FT_Angle angle ); 1.152 + 1.153 + 1.154 + /************************************************************************* 1.155 + * 1.156 + * @function: 1.157 + * FT_Tan 1.158 + * 1.159 + * @description: 1.160 + * Return the tangent of a given angle in fixed point format. 1.161 + * 1.162 + * @input: 1.163 + * angle :: 1.164 + * The input angle. 1.165 + * 1.166 + * @return: 1.167 + * The tangent value. 1.168 + * 1.169 + */ 1.170 + FT_EXPORT( FT_Fixed ) 1.171 + FT_Tan( FT_Angle angle ); 1.172 + 1.173 + 1.174 + /************************************************************************* 1.175 + * 1.176 + * @function: 1.177 + * FT_Atan2 1.178 + * 1.179 + * @description: 1.180 + * Return the arc-tangent corresponding to a given vector (x,y) in 1.181 + * the 2d plane. 1.182 + * 1.183 + * @input: 1.184 + * x :: 1.185 + * The horizontal vector coordinate. 1.186 + * 1.187 + * y :: 1.188 + * The vertical vector coordinate. 1.189 + * 1.190 + * @return: 1.191 + * The arc-tangent value (i.e. angle). 1.192 + * 1.193 + */ 1.194 + FT_EXPORT( FT_Angle ) 1.195 + FT_Atan2( FT_Fixed x, 1.196 + FT_Fixed y ); 1.197 + 1.198 + 1.199 + /************************************************************************* 1.200 + * 1.201 + * @function: 1.202 + * FT_Angle_Diff 1.203 + * 1.204 + * @description: 1.205 + * Return the difference between two angles. The result is always 1.206 + * constrained to the ]-PI..PI] interval. 1.207 + * 1.208 + * @input: 1.209 + * angle1 :: 1.210 + * First angle. 1.211 + * 1.212 + * angle2 :: 1.213 + * Second angle. 1.214 + * 1.215 + * @return: 1.216 + * Constrained value of `value2-value1'. 1.217 + * 1.218 + */ 1.219 + FT_EXPORT( FT_Angle ) 1.220 + FT_Angle_Diff( FT_Angle angle1, 1.221 + FT_Angle angle2 ); 1.222 + 1.223 + 1.224 + /************************************************************************* 1.225 + * 1.226 + * @function: 1.227 + * FT_Vector_Unit 1.228 + * 1.229 + * @description: 1.230 + * Return the unit vector corresponding to a given angle. After the 1.231 + * call, the value of `vec.x' will be `sin(angle)', and the value of 1.232 + * `vec.y' will be `cos(angle)'. 1.233 + * 1.234 + * This function is useful to retrieve both the sinus and cosinus of a 1.235 + * given angle quickly. 1.236 + * 1.237 + * @output: 1.238 + * vec :: 1.239 + * The address of target vector. 1.240 + * 1.241 + * @input: 1.242 + * angle :: 1.243 + * The address of angle. 1.244 + * 1.245 + */ 1.246 + FT_EXPORT( void ) 1.247 + FT_Vector_Unit( FT_Vector* vec, 1.248 + FT_Angle angle ); 1.249 + 1.250 + 1.251 + /************************************************************************* 1.252 + * 1.253 + * @function: 1.254 + * FT_Vector_Rotate 1.255 + * 1.256 + * @description: 1.257 + * Rotate a vector by a given angle. 1.258 + * 1.259 + * @inout: 1.260 + * vec :: 1.261 + * The address of target vector. 1.262 + * 1.263 + * @input: 1.264 + * angle :: 1.265 + * The address of angle. 1.266 + * 1.267 + */ 1.268 + FT_EXPORT( void ) 1.269 + FT_Vector_Rotate( FT_Vector* vec, 1.270 + FT_Angle angle ); 1.271 + 1.272 + 1.273 + /************************************************************************* 1.274 + * 1.275 + * @function: 1.276 + * FT_Vector_Length 1.277 + * 1.278 + * @description: 1.279 + * Return the length of a given vector. 1.280 + * 1.281 + * @input: 1.282 + * vec :: 1.283 + * The address of target vector. 1.284 + * 1.285 + * @return: 1.286 + * The vector length, expressed in the same units that the original 1.287 + * vector coordinates. 1.288 + * 1.289 + */ 1.290 + FT_EXPORT( FT_Fixed ) 1.291 + FT_Vector_Length( FT_Vector* vec ); 1.292 + 1.293 + 1.294 + /************************************************************************* 1.295 + * 1.296 + * @function: 1.297 + * FT_Vector_Polarize 1.298 + * 1.299 + * @description: 1.300 + * Compute both the length and angle of a given vector. 1.301 + * 1.302 + * @input: 1.303 + * vec :: 1.304 + * The address of source vector. 1.305 + * 1.306 + * @output: 1.307 + * length :: 1.308 + * The vector length. 1.309 + * 1.310 + * angle :: 1.311 + * The vector angle. 1.312 + * 1.313 + */ 1.314 + FT_EXPORT( void ) 1.315 + FT_Vector_Polarize( FT_Vector* vec, 1.316 + FT_Fixed *length, 1.317 + FT_Angle *angle ); 1.318 + 1.319 + 1.320 + /************************************************************************* 1.321 + * 1.322 + * @function: 1.323 + * FT_Vector_From_Polar 1.324 + * 1.325 + * @description: 1.326 + * Compute vector coordinates from a length and angle. 1.327 + * 1.328 + * @output: 1.329 + * vec :: 1.330 + * The address of source vector. 1.331 + * 1.332 + * @input: 1.333 + * length :: 1.334 + * The vector length. 1.335 + * 1.336 + * angle :: 1.337 + * The vector angle. 1.338 + * 1.339 + */ 1.340 + FT_EXPORT( void ) 1.341 + FT_Vector_From_Polar( FT_Vector* vec, 1.342 + FT_Fixed length, 1.343 + FT_Angle angle ); 1.344 + 1.345 + /* */ 1.346 + 1.347 + 1.348 +FT_END_HEADER 1.349 + 1.350 +#endif /* __FTTRIGON_H__ */ 1.351 + 1.352 + 1.353 +/* END */