~compiz-team/compiz-animation-plugin/oneiric

« back to all changes in this revision

Viewing changes to include/animation/point3d.h

  • Committer: Jay Catherwood
  • Date: 2010-08-11 17:29:34 UTC
  • mfrom: (360.1.3)
  • Revision ID: git-v1:e9cd23298aa13192825a758ba620871efd66d3fd
Merge branch 'master' of git://anongit.compiz.org/compiz/plugins/animation

Show diffs side-by-side

added added

removed removed

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