ReactOS 0.4.16-dev-2332-g4cba65d
fttrigon.h File Reference
Include dependency graph for fttrigon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_ANGLE_PI   ( 180L << 16 )
 
#define FT_ANGLE_2PI   ( FT_ANGLE_PI * 2 )
 
#define FT_ANGLE_PI2   ( FT_ANGLE_PI / 2 )
 
#define FT_ANGLE_PI4   ( FT_ANGLE_PI / 4 )
 

Functions

 FT_Sin (FT_Angle angle)
 
 FT_Cos (FT_Angle angle)
 
 FT_Tan (FT_Angle angle)
 
 FT_Atan2 (FT_Fixed x, FT_Fixed y)
 
 FT_Angle_Diff (FT_Angle angle1, FT_Angle angle2)
 
 FT_Vector_Unit (FT_Vector *vec, FT_Angle angle)
 
 FT_Vector_Rotate (FT_Vector *vec, FT_Angle angle)
 
 FT_Vector_Length (FT_Vector *vec)
 
 FT_Vector_Polarize (FT_Vector *vec, FT_Fixed *length, FT_Angle *angle)
 
 FT_Vector_From_Polar (FT_Vector *vec, FT_Fixed length, FT_Angle angle)
 

Variables

FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
 

Macro Definition Documentation

◆ FT_ANGLE_2PI

#define FT_ANGLE_2PI   ( FT_ANGLE_PI * 2 )

Definition at line 76 of file fttrigon.h.

◆ FT_ANGLE_PI

#define FT_ANGLE_PI   ( 180L << 16 )

Definition at line 64 of file fttrigon.h.

◆ FT_ANGLE_PI2

#define FT_ANGLE_PI2   ( FT_ANGLE_PI / 2 )

Definition at line 88 of file fttrigon.h.

◆ FT_ANGLE_PI4

#define FT_ANGLE_PI4   ( FT_ANGLE_PI / 4 )

Definition at line 100 of file fttrigon.h.

Function Documentation

◆ FT_Angle_Diff()

FT_Angle_Diff ( FT_Angle  angle1,
FT_Angle  angle2 
)

Definition at line 501 of file fttrigon.c.

503 {
504 FT_Angle delta = angle2 - angle1;
505
506
507 while ( delta <= -FT_ANGLE_PI )
508 delta += FT_ANGLE_2PI;
509
510 while ( delta > FT_ANGLE_PI )
511 delta -= FT_ANGLE_2PI;
512
513 return delta;
514 }
FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
Definition: fttrigon.h:52
#define FT_ANGLE_PI
Definition: fttrigon.h:64
#define FT_ANGLE_2PI
Definition: fttrigon.h:76

Referenced by ft_angle_mean(), ft_conic_is_small_enough(), ft_cubic_is_small_enough(), ft_stroker_arcto(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), FT_Stroker_EndSubPath(), ft_stroker_inside(), ft_stroker_outside(), and ft_stroker_process_corner().

◆ FT_Atan2()

FT_Atan2 ( FT_Fixed  x,
FT_Fixed  y 
)

Definition at line 339 of file fttrigon.c.

341 {
342 FT_Vector v;
343
344
345 if ( dx == 0 && dy == 0 )
346 return 0;
347
348 v.x = dx;
349 v.y = dy;
350 ft_trig_prenorm( &v );
352
353 return v.y;
354 }
static void ft_trig_pseudo_polarize(FT_Vector *vec)
Definition: fttrigon.c:218
static FT_Int ft_trig_prenorm(FT_Vector *vec)
Definition: fttrigon.c:133
const GLdouble * v
Definition: gl.h:2040
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by ft_conic_is_small_enough(), ft_cubic_is_small_enough(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), and FT_Stroker_LineTo().

◆ FT_Cos()

FT_Cos ( FT_Angle  angle)

Definition at line 297 of file fttrigon.c.

298 {
299 FT_Vector v;
300
301
303
304 return v.x;
305 }
FT_Vector_Unit(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:360
GLfloat angle
Definition: glext.h:10853

Referenced by FT_Stroker_ConicTo(), and FT_Stroker_CubicTo().

◆ FT_Sin()

FT_Sin ( FT_Angle  angle)

Definition at line 311 of file fttrigon.c.

312 {
313 FT_Vector v;
314
315
317
318 return v.y;
319 }

Referenced by FT_Stroker_ConicTo(), and FT_Stroker_CubicTo().

◆ FT_Tan()

FT_Tan ( FT_Angle  angle)

Definition at line 325 of file fttrigon.c.

326 {
327 FT_Vector v = { 1 << 24, 0 };
328
329
331
332 return FT_DivFix( v.y, v.x );
333 }
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:607
static void ft_trig_pseudo_rotate(FT_Vector *vec, FT_Angle theta)
Definition: fttrigon.c:163

Referenced by ft_stroke_border_arcto().

◆ FT_Vector_From_Polar()

FT_Vector_From_Polar ( FT_Vector vec,
FT_Fixed  length,
FT_Angle  angle 
)

Definition at line 484 of file fttrigon.c.

487 {
488 if ( !vec )
489 return;
490
491 vec->x = length;
492 vec->y = 0;
493
495 }
FT_Vector * vec
Definition: ftbbox.c:469
FT_Vector_Rotate(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:377
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78

Referenced by ft_stroke_border_arcto(), ft_stroker_cap(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), ft_stroker_inside(), FT_Stroker_LineTo(), ft_stroker_outside(), and ft_stroker_subpath_start().

◆ FT_Vector_Length()

FT_Vector_Length ( FT_Vector vec)

Definition at line 417 of file fttrigon.c.

418 {
420 FT_Vector v;
421
422
423 if ( !vec )
424 return 0;
425
426 v = *vec;
427
428 /* handle trivial cases */
429 if ( v.x == 0 )
430 {
431 return FT_ABS( v.y );
432 }
433 else if ( v.y == 0 )
434 {
435 return FT_ABS( v.x );
436 }
437
438 /* general case */
439 shift = ft_trig_prenorm( &v );
441
442 v.x = ft_trig_downscale( v.x );
443
444 if ( shift > 0 )
445 return ( v.x + ( 1L << ( shift - 1 ) ) ) >> shift;
446
447 return (FT_Fixed)( (FT_UInt32)v.x << -shift );
448 }
#define FT_ABS(a)
Definition: ftobjs.h:73
static FT_Fixed ft_trig_downscale(FT_Fixed val)
Definition: fttrigon.c:83
signed long FT_Fixed
Definition: fttypes.h:287
signed int FT_Int
Definition: fttypes.h:220
#define shift
Definition: input.c:1755

Referenced by FT_Hypot(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), and FT_Stroker_LineTo().

◆ FT_Vector_Polarize()

FT_Vector_Polarize ( FT_Vector vec,
FT_Fixed length,
FT_Angle angle 
)

Definition at line 454 of file fttrigon.c.

457 {
459 FT_Vector v;
460
461
462 if ( !vec || !length || !angle )
463 return;
464
465 v = *vec;
466
467 if ( v.x == 0 && v.y == 0 )
468 return;
469
470 shift = ft_trig_prenorm( &v );
472
473 v.x = ft_trig_downscale( v.x );
474
475 *length = shift >= 0 ? ( v.x >> shift )
476 : (FT_Fixed)( (FT_UInt32)v.x << -shift );
477 *angle = v.y;
478 }

◆ FT_Vector_Rotate()

FT_Vector_Rotate ( FT_Vector vec,
FT_Angle  angle 
)

Definition at line 377 of file fttrigon.c.

379 {
381 FT_Vector v;
382
383
384 if ( !vec || !angle )
385 return;
386
387 v = *vec;
388
389 if ( v.x == 0 && v.y == 0 )
390 return;
391
392 shift = ft_trig_prenorm( &v );
394 v.x = ft_trig_downscale( v.x );
395 v.y = ft_trig_downscale( v.y );
396
397 if ( shift > 0 )
398 {
399 FT_Int32 half = (FT_Int32)1L << ( shift - 1 );
400
401
402 vec->x = ( v.x + half - ( v.x < 0 ) ) >> shift;
403 vec->y = ( v.y + half - ( v.y < 0 ) ) >> shift;
404 }
405 else
406 {
407 shift = -shift;
408 vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
409 vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
410 }
411 }
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
unsigned long FT_ULong
Definition: fttypes.h:253

Referenced by FT_Vector_From_Polar().

◆ FT_Vector_Unit()

FT_Vector_Unit ( FT_Vector vec,
FT_Angle  angle 
)

Definition at line 360 of file fttrigon.c.

362 {
363 if ( !vec )
364 return;
365
366 vec->x = FT_TRIG_SCALE >> 8;
367 vec->y = 0;
369 vec->x = ( vec->x + 0x80L ) >> 8;
370 vec->y = ( vec->y + 0x80L ) >> 8;
371 }
#define FT_TRIG_SCALE
Definition: fttrigon.c:38

Referenced by FT_Cos(), FT_Sin(), ft_stroker_inside(), and IntEscapeMatrix().

Variable Documentation

◆ FT_Angle