* include/freetype/fttrigon.h: __FT_TRIGONOMETRY_H__ -> __FTTRIGON_H__. Include FT_FREETYPE_H. Beautified; added copyright. * src/base/fttrigon.c: Beautified; added copyright.VER-2-0-4-PATCH
parent
3bf46a41b9
commit
c634580a51
4 changed files with 290 additions and 196 deletions
@ -1,213 +1,265 @@ |
||||
#ifndef __FT_TRIGONOMETRY_H__ |
||||
#define __FT_TRIGONOMETRY_H__ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* fttrigon.h */ |
||||
/* */ |
||||
/* FreeType trigonometric functions (specification). */ |
||||
/* */ |
||||
/* Copyright 2001 by */ |
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
||||
/* */ |
||||
/* This file is part of the FreeType project, and may only be used, */ |
||||
/* modified, and distributed under the terms of the FreeType project */ |
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __FTTRIGON_H__ |
||||
#define __FTTRIGON_H__ |
||||
|
||||
#include FT_FREETYPE_H |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @section: computations |
||||
* @section: |
||||
* computations |
||||
* |
||||
*/ |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @type: FT_Angle |
||||
* @type: |
||||
* FT_Angle |
||||
* |
||||
* @description: |
||||
* this type is used to model angle values in FreeType. Note that |
||||
* the angle is a 16.16 fixed float value expressed in _degrees_ |
||||
* This type is used to model angle values in FreeType. Note that |
||||
* the angle is a 16.16 fixed float value expressed in degrees. |
||||
*/ |
||||
typedef FT_Fixed FT_Angle; |
||||
typedef FT_Fixed FT_Angle; |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @macro: FT_ANGLE_PI |
||||
* @macro: |
||||
* FT_ANGLE_PI |
||||
* |
||||
* @description: |
||||
* the angle pi expressed in @FT_Angle units |
||||
* The angle pi expressed in @FT_Angle units. |
||||
*/ |
||||
#define FT_ANGLE_PI (180L << 16) |
||||
#define FT_ANGLE_PI ( 180L << 16 ) |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @macro: FT_ANGLE_2PI |
||||
* @macro: |
||||
* FT_ANGLE_2PI |
||||
* |
||||
* @description: |
||||
* the angle 2pi expressed in @FT_Angle units |
||||
* The angle 2*pi expressed in @FT_Angle units. |
||||
*/ |
||||
#define FT_ANGLE_2PI (FT_ANGLE_PI*2) |
||||
#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @macro: FT_ANGLE_PI2 |
||||
* @macro: |
||||
* FT_ANGLE_PI2 |
||||
* |
||||
* @description: |
||||
* the angle pi/2 expressed in @FT_Angle units |
||||
* The angle pi/2 expressed in @FT_Angle units. |
||||
*/ |
||||
#define FT_ANGLE_PI2 (FT_ANGLE_PI/2) |
||||
#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @macro: FT_ANGLE_PI4 |
||||
* @macro: |
||||
* FT_ANGLE_PI4 |
||||
* |
||||
* @description: |
||||
* the angle pi/4 expressed in @FT_Angle units |
||||
* The angle pi/4 expressed in @FT_Angle units. |
||||
*/ |
||||
#define FT_ANGLE_PI4 (FT_ANGLE_PI/4) |
||||
#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Sin |
||||
* @function: |
||||
* FT_Sin |
||||
* |
||||
* @description: |
||||
* return the sinus of a given angle in fixed point format |
||||
* Return the sinus of a given angle in fixed point format. |
||||
* |
||||
* @input: |
||||
* angle :: input angle |
||||
* angle :: The input angle. |
||||
* |
||||
* @return: |
||||
* sinus value |
||||
* The sinus value. |
||||
* |
||||
* @note: |
||||
* if you need both the sinus and cosinus for a given angle, you'd |
||||
* better use the function @FT_Vector_Unit |
||||
* If you need both the sinus and cosinus for a given angle, use the |
||||
* function @FT_Vector_Unit. |
||||
*/ |
||||
FT_EXPORT(FT_Fixed) FT_Sin( FT_Angle angle ); |
||||
FT_EXPORT( FT_Fixed ) FT_Sin( FT_Angle angle ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Cos |
||||
* @function: |
||||
* FT_Cos |
||||
* |
||||
* @description: |
||||
* return the cosinus of a given angle in fixed point format |
||||
* Return the cosinus of a given angle in fixed point format. |
||||
* |
||||
* @input: |
||||
* angle :: input angle |
||||
* angle :: The input angle. |
||||
* |
||||
* @return: |
||||
* cosinus value |
||||
* The cosinus value. |
||||
* |
||||
* @note: |
||||
* if you need both the sinus and cosinus for a given angle, you'd |
||||
* better use the function @FT_Vector_Unit |
||||
* If you need both the sinus and cosinus for a given angle, use the |
||||
* function @FT_Vector_Unit. |
||||
*/ |
||||
FT_EXPORT(FT_Fixed) FT_Cos( FT_Angle angle );
|
||||
FT_EXPORT( FT_Fixed ) FT_Cos( FT_Angle angle );
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Tan |
||||
* @function: |
||||
* FT_Tan |
||||
* |
||||
* @description: |
||||
* return the tangent of a given angle in fixed point format |
||||
* Return the tangent of a given angle in fixed point format. |
||||
* |
||||
* @input: |
||||
* angle :: input angle |
||||
* angle :: The input angle. |
||||
* |
||||
* @return: |
||||
* tangent value |
||||
* The tangent value. |
||||
*/ |
||||
FT_EXPORT(FT_Fixed) FT_Tan( FT_Angle angle ); |
||||
FT_EXPORT( FT_Fixed ) FT_Tan( FT_Angle angle ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Atan2 |
||||
* @function: |
||||
* FT_Atan2 |
||||
* |
||||
* @description: |
||||
* return the arc-tangent corresponding to a given vector (x,y) in |
||||
* the 2d plane |
||||
* Return the arc-tangent corresponding to a given vector (x,y) in |
||||
* the 2d plane. |
||||
* |
||||
* @input: |
||||
* x :: horizontal vector coordinate |
||||
* y :: vertical vector coordinate |
||||
* x :: The horizontal vector coordinate. |
||||
* y :: The vertical vector coordinate. |
||||
* |
||||
* @return: |
||||
* arc-tangent value (i.e. angle) |
||||
* The arc-tangent value (i.e. angle). |
||||
*/ |
||||
FT_EXPORT(FT_Angle) FT_Atan2( FT_Fixed x, FT_Fixed y ); |
||||
FT_EXPORT( FT_Angle ) FT_Atan2( FT_Fixed x, FT_Fixed y ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Vector_Unit |
||||
* @function: |
||||
* FT_Vector_Unit |
||||
* |
||||
* @description: |
||||
* return the unit vector corresponding to a given angle. After the call, |
||||
* Return the unit vector corresponding to a given angle. After the call, |
||||
* the value of "vec.x" will be "sin(theta)", and the value of "vec.y" |
||||
* will be "cos(angle)" |
||||
* will be "cos(angle)". |
||||
* |
||||
* this function is useful to retrieve both the sinus and cosinus |
||||
* of a given angle quickly |
||||
* This function is useful to retrieve both the sinus and cosinus of a |
||||
* given angle quickly. |
||||
* |
||||
* @input: |
||||
* vec :: address of target vector |
||||
* angle :: address of angle |
||||
* vec :: The address of target vector. |
||||
* angle :: The address of angle. |
||||
*/ |
||||
FT_EXPORT(void) FT_Vector_Unit( FT_Vector* vec, |
||||
FT_Angle angle ); |
||||
FT_EXPORT( void ) FT_Vector_Unit( FT_Vector* vec, |
||||
FT_Angle angle ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Vector_Rotate |
||||
* @function: |
||||
* FT_Vector_Rotate |
||||
* |
||||
* @description: |
||||
* rotate a given vector by a given angle |
||||
* Rotate a vector by a given angle. |
||||
* |
||||
* @input: |
||||
* vec :: address of target vector |
||||
* angle :: address of angle |
||||
* vec :: The address of target vector. |
||||
* angle :: The address of angle. |
||||
*/ |
||||
FT_EXPORT(void) FT_Vector_Rotate( FT_Vector* vec, |
||||
FT_Angle angle ); |
||||
FT_EXPORT( void ) FT_Vector_Rotate( FT_Vector* vec, |
||||
FT_Angle angle ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Vector_Length |
||||
* @function: |
||||
* FT_Vector_Length |
||||
* |
||||
* @description: |
||||
* returns the length of a given vector |
||||
* Return the length of a given vector. |
||||
* |
||||
* @input: |
||||
* vec :: address of target vector |
||||
* vec :: The address of target vector. |
||||
* |
||||
* @return: |
||||
* vector length, expressed in the same units that the original |
||||
* vector coordinates !! |
||||
* The vector length, expressed in the same units that the original |
||||
* vector coordinates. |
||||
*/ |
||||
FT_EXPORT(FT_Fixed) FT_Vector_Length( FT_Vector* vec ); |
||||
FT_EXPORT( FT_Fixed ) FT_Vector_Length( FT_Vector* vec ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Vector_Normalize |
||||
* @function: |
||||
* FT_Vector_Normalize |
||||
* |
||||
* @description: |
||||
* normalize a given vector (i.e. compute the equivalent unit vector) |
||||
* Normalize a given vector (i.e. compute the equivalent unit vector). |
||||
* |
||||
* @input: |
||||
* vec :: address of target vector |
||||
* vec :: The address of target vector. |
||||
*/ |
||||
FT_EXPORT(void) FT_Vector_Normalize( FT_Vector* vec ); |
||||
FT_EXPORT( void ) FT_Vector_Normalize( FT_Vector* vec ); |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* |
||||
* @function: FT_Vector_Polarize |
||||
* @function: |
||||
* FT_Vector_Polarize |
||||
* |
||||
* @description: |
||||
* compute both the length and angle of a given vector |
||||
* Compute both the length and angle of a given vector. |
||||
* |
||||
* @input: |
||||
* vec :: address of source vector |
||||
* vec :: The address of source vector. |
||||
* |
||||
* @output: |
||||
* length :: vector length |
||||
* angle :: vector angle |
||||
* length :: The vector length. |
||||
* angle :: The vector angle. |
||||
*/ |
||||
FT_EXPORT(void) FT_Vector_Polarize( FT_Vector* vec, |
||||
FT_Fixed *length, |
||||
FT_Angle *angle ); |
||||
FT_EXPORT( void ) FT_Vector_Polarize( FT_Vector* vec, |
||||
FT_Fixed *length, |
||||
FT_Angle *angle ); |
||||
/* */ |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __FT_TRIGONOMETRY_H__ */ |
||||
#endif /* __FTTRIGON_H__ */ |
||||
|
||||
|
||||
/* END */ |
||||
|
Loading…
Reference in new issue