~kzmd-deactivatedaccount/ubuntu/natty/compiz-plugins-main/popup-delay-fix-772177

« back to all changes in this revision

Viewing changes to animation/include/animation/point3d.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-02-24 17:34:18 UTC
  • Revision ID: james.westby@ubuntu.com-20110224173418-b81hfllshqpciq6n
Tags: upstream-0.9.4
ImportĀ upstreamĀ versionĀ 0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ANIMATION_POINT_H
 
2
#define ANIMATION_POINT_H
 
3
#include "animation.h"
 
4
 
 
5
class Point
 
6
{
 
7
public:
 
8
     Point () : mX (0), mY (0) {}
 
9
     Point (float x, float y) : mX (x), mY (y) {}
 
10
     
 
11
     inline float x () const { return mX; }
 
12
     inline float y () const { return mY; }
 
13
     
 
14
     inline void setX (float x) { mX = x; }
 
15
     inline void setY (float y) { mY = y; }
 
16
     
 
17
     void set (float x, float y) { mX = x; mY = y; }
 
18
     
 
19
     inline void add (const Point &p) { mX += p.x (); mY += p.y (); }
 
20
     
 
21
     Point &operator= (const Point &p);
 
22
     bool operator== (const Point &p) const;
 
23
     bool operator!= (const Point &p) const;
 
24
     
 
25
private:
 
26
     float mX, mY;
 
27
};
 
28
 
 
29
typedef Point Vector;
 
30
 
 
31
class Point3d
 
32
{
 
33
    public:
 
34
        Point3d () : mX (0), mY (0), mZ (0) {}
 
35
        Point3d (float x, float y, float z) : mX (x), mY (y), mZ (z) {}
 
36
 
 
37
        inline float x () const { return mX; }
 
38
        inline float y () const { return mY; }
 
39
        inline float z () const { return mZ; }
 
40
 
 
41
        inline void setX (float x) { mX = x; }
 
42
        inline void setY (float y) { mY = y; }
 
43
        inline void setZ (float z) { mZ = z; }
 
44
 
 
45
        inline void set (float x, float y, float z) { mX = x; mY = y; mZ = z; }
 
46
 
 
47
        inline void add (const Point3d &p)
 
48
        { mX += p.x (); mY += p.y (); mZ += p.z (); }
 
49
        inline void add (float x, float y, float z)
 
50
        { mX += x; mY += y; mZ += z; }
 
51
 
 
52
        Point3d &operator= (const Point3d &p);
 
53
        bool operator== (const Point3d &p) const;
 
54
        bool operator!= (const Point3d &p) const;
 
55
 
 
56
    private:
 
57
        float mX, mY, mZ;
 
58
};
 
59
 
 
60
typedef Point3d Vector3d;
 
61
 
 
62
/* XXX: change this to CompRect */
 
63
typedef struct
 
64
{
 
65
    float x1, x2, y1, y2;
 
66
} Boxf;
 
67
 
 
68
inline Point &
 
69
Point::operator= (const Point &p)
 
70
{
 
71
    mX = p.x (); mY = p.y ();
 
72
    return *this;
 
73
}
 
74
 
 
75
inline bool
 
76
Point::operator== (const Point &p) const
 
77
{
 
78
    return (mX == p.x () && mY == p.y ());
 
79
}
 
80
 
 
81
inline bool
 
82
Point::operator!= (const Point &p) const
 
83
{
 
84
    return !(*this == p);
 
85
}
 
86
 
 
87
inline Point3d &
 
88
Point3d::operator= (const Point3d &p)
 
89
{
 
90
    mX = p.x (); mY = p.y (); mZ = p.z ();
 
91
    return *this;
 
92
}
 
93
 
 
94
inline bool
 
95
Point3d::operator== (const Point3d &p) const
 
96
{
 
97
    return (mX == p.x () && mY == p.y () && mZ == p.z ());
 
98
}
 
99
 
 
100
inline bool
 
101
Point3d::operator!= (const Point3d &p) const
 
102
{
 
103
    return !(*this == p);
 
104
}
 
105
#endif