File: utilAffineTransform.h

package info (click to toggle)
ted 2.16-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,944 kB
  • ctags: 20,273
  • sloc: ansic: 167,980; makefile: 12,518; sh: 263
file content (107 lines) | stat: -rw-r--r-- 3,163 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#   ifndef	UTIL_AFFINE_TRANSFORM_H
#   define	UTIL_AFFINE_TRANSFORM_H

/************************************************************************/
/*									*/
/*  Affine transformation 2 dimensional.				*/
/*									*/
/************************************************************************/

typedef struct AffineTransform2D
    {
    double		at2Axx;
    double		at2Axy;
    double		at2Ayx;
    double		at2Ayy;
    double		at2Tx;
    double		at2Ty;
    } AffineTransform2D;

#   define	AT2_X( x, y, at ) \
			( (at)->at2Axx* (x)+ (at)->at2Ayx* (y)+ (at)->at2Tx )
#   define	AT2_Y( x, y, at ) \
			( (at)->at2Axy* (x)+ (at)->at2Ayy* (y)+ (at)->at2Ty )

/************************************************************************/
/*									*/
/*  Affine transformation 3 dimensional.				*/
/*									*/
/************************************************************************/

typedef struct AffineTransform3D
    {
    double	at3Axx;
    double	at3Axy;
    double	at3Axz;

    double	at3Ayx;
    double	at3Ayy;
    double	at3Ayz;

    double	at3Azx;
    double	at3Azy;
    double	at3Azz;

    double	at3Tx;
    double	at3Ty;
    double	at3Tz;
    } AffineTransform3D;

#   define AT3_X( x, y, z, at ) \
	( (at)->at3Axx* (x)+ (at)->at3Ayx* (y)+ (at)->at3Azx* (z)+ (at)->at3Tx )
#   define AT3_Y( x, y, z, at ) \
	( (at)->at3Axy* (x)+ (at)->at3Ayy* (y)+ (at)->at3Azy* (z)+ (at)->at3Ty )
#   define AT3_Z( x, y, z, at ) \
	( (at)->at3Axz* (x)+ (at)->at3Ayz* (y)+ (at)->at3Azz* (z)+ (at)->at3Tz )

/************************************************************************/
/*									*/
/*  Routine Declarations.						*/
/*									*/
/************************************************************************/

extern int utilAffineTransformForTriangles(	AffineTransform2D *	atRes,
						double			x_1,
						double			x_2,
						double			y_1,
						double			y_2,
						double			z_1,
						double			z_2,
						double			p_1,
						double			p_2,
						double			q_1,
						double			q_2,
						double			r_1,
						double			r_2 );

extern void utilInitAffineTransform2D(		AffineTransform2D *	at2 );
extern void utilIdentityAffineTransform2D(	AffineTransform2D *	at2 );
extern void utilRotationAffineTransform2D(	AffineTransform2D *	at2,
						double			a );

extern void utilAffineTransform2DProduct(
					AffineTransform2D *		ba,
					const AffineTransform2D *	b,
					const AffineTransform2D *	a );

extern double utilAffineTransformDeterminant2D(
					const AffineTransform2D *	at2 );

extern void utilInitAffineTransform3D(		AffineTransform3D *	at3 );
extern void utilIdentityAffineTransform3D(	AffineTransform3D *	at3 );
extern void utilXYRotationAffineTransform3D(	AffineTransform3D *	at3,
						double			a );
extern void utilXZRotationAffineTransform3D(	AffineTransform3D *	at3,
						double			a );
extern void utilYZRotationAffineTransform3D(	AffineTransform3D *	at3,
						double			a );

extern void utilAffineTransform3DProduct(
					AffineTransform3D *		ba,
					const AffineTransform3D *	b,
					const AffineTransform3D *	a );

extern double utilAffineTransformDeterminant3D(
					const AffineTransform3D *	at3 );

#   endif	/*  UTIL_AFFINE_TRANSFORM_H	*/