File: FTPoint.h

package info (click to toggle)
mysql-query-browser 1.2.5beta-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 63,792 kB
  • ctags: 46,485
  • sloc: pascal: 249,299; ansic: 80,111; cpp: 72,467; sh: 25,271; objc: 20,015; yacc: 10,755; java: 9,917; xml: 4,580; php: 2,806; python: 1,566; sql: 1,563; makefile: 1,452; perl: 3
file content (162 lines) | stat: -rw-r--r-- 3,813 bytes parent folder | download | duplicates (4)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#ifndef     __FTPoint__
#define     __FTPoint__

#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_GLYPH_H

#include "FTGL.h"

/**
 * FTPoint class is a basic 3 dimensional point or vector.
 */
class FTGL_EXPORT FTPoint
{
    public:
        /**
         * Default constructor. Point is set to zero.
         */
        FTPoint()
        {
            values[0] = 0;
            values[1] = 0;
            values[2] = 0;
        }
        
        /**
         * Constructor.
         *
         * @param x First component
         * @param y Second component
         * @param z Third component
         */
        FTPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
        {
            values[0] = x;
            values[1] = y;
            values[2] = z;
        }
        
        /**
         * Constructor. This converts an FT_Vector to an FT_Point
         *
         * @param ft_vector A freetype vector
         */
        FTPoint( const FT_Vector& ft_vector)
        {
            values[0] = ft_vector.x;
            values[1] = ft_vector.y;
            values[2] = 0;
        }
        
        /**
         * Operator += In Place Addition.
         *
         * @param point
         * @return this plus point.
         */
        FTPoint& operator += ( const FTPoint& point)
        {
            values[0] += point.values[0];
            values[1] += point.values[1];
            values[2] += point.values[2];

            return *this;
        }

        /**
         * Operator +
         *
         * @param point
         * @return this plus point.
         */
        FTPoint operator + ( const FTPoint& point)
        {
            FTPoint temp;
            temp.values[0] = values[0] + point.values[0];
            temp.values[1] = values[1] + point.values[1];
            temp.values[2] = values[2] + point.values[2];

            return temp;
        }
        
        
        /**
         * Operator *
         *
         * @param multiplier
         * @return <code>this</code> multiplied by <code>multiplier</code>.
         */
        FTPoint operator * ( double multiplier)
        {
            FTPoint temp;
            temp.values[0] = values[0] * multiplier;
            temp.values[1] = values[1] * multiplier;
            temp.values[2] = values[2] * multiplier;

            return temp;
        }
        
        
        /**
         * Operator *
         *
         * @param point
         * @param multiplier
         * @return <code>multiplier</code> multiplied by <code>point</code>.
         */
        friend FTPoint operator*( double multiplier, FTPoint& point);


        /**
         * Operator == Tests for eqaulity
         *
         * @param a
         * @param b
         * @return true if a & b are equal
         */
        friend bool operator == ( const FTPoint &a, const FTPoint &b);

        /**
         * Operator != Tests for non equality
         *
         * @param a
         * @param b
         * @return true if a & b are not equal
         */
        friend bool operator != ( const FTPoint &a, const FTPoint &b);
        
        
        /**
         * Cast to FTGL_DOUBLE*
         */
        operator const FTGL_DOUBLE*() const
        {
            return values;
        }
        

        /**
         * Setters
         */
        void X( FTGL_DOUBLE x) { values[0] = x;};
        void Y( FTGL_DOUBLE y) { values[1] = y;};
        void Z( FTGL_DOUBLE z) { values[2] = z;};


        /**
         * Getters
         */
        FTGL_DOUBLE X() const { return values[0];};
        FTGL_DOUBLE Y() const { return values[1];};
        FTGL_DOUBLE Z() const { return values[2];};
        
    private:
        /**
         * The point data
         */
        FTGL_DOUBLE values[3];
};

#endif  //  __FTPoint__