OpenSceneGraph 3.6.5
Vec2ui
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_VEC2UI
15#define OSG_VEC2UI 1
16
17namespace osg {
18
21class Vec2ui
22{
23 public:
24
26 typedef unsigned int value_type;
27
29 enum { num_components = 2 };
30
33
34 Vec2ui() { _v[0]=0; _v[1]=0; }
35
36 Vec2ui(value_type x, value_type y) { _v[0] = x; _v[1] = y; }
37
38 inline bool operator == (const Vec2ui& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1]; }
39 inline bool operator != (const Vec2ui& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1]; }
40 inline bool operator < (const Vec2ui& v) const
41 {
42 if (_v[0]<v._v[0]) return true;
43 else if (_v[0]>v._v[0]) return false;
44 else return (_v[1]<v._v[1]);
45 }
46
47 inline value_type* ptr() { return _v; }
48 inline const value_type* ptr() const { return _v; }
49
50 inline void set( value_type x, value_type y)
51 {
52 _v[0]=x; _v[1]=y;
53 }
54
55 inline void set( const Vec2ui& rhs)
56 {
57 _v[0]=rhs._v[0]; _v[1]=rhs._v[1];
58 }
59
60 inline value_type& operator [] (int i) { return _v[i]; }
61 inline value_type operator [] (int i) const { return _v[i]; }
62
63 inline value_type& x() { return _v[0]; }
64 inline value_type& y() { return _v[1]; }
65
66 inline value_type x() const { return _v[0]; }
67 inline value_type y() const { return _v[1]; }
68
69 inline value_type& r() { return _v[0]; }
70 inline value_type& g() { return _v[1]; }
71
72 inline value_type r() const { return _v[0]; }
73 inline value_type g() const { return _v[1]; }
74
75 inline Vec2ui operator * (value_type rhs) const
76 {
77 return Vec2ui(_v[0]*rhs, _v[1]*rhs);
78 }
79
80 inline Vec2ui operator / (value_type rhs) const
81 {
82 return Vec2ui(_v[0]/rhs, _v[1]/rhs);
83 }
84
85 inline Vec2ui operator + (value_type rhs) const
86 {
87 return Vec2ui(_v[0]+rhs, _v[1]+rhs);
88 }
89
90 inline Vec2ui operator - (value_type rhs) const
91 {
92 return Vec2ui(_v[0]-rhs, _v[1]-rhs);
93 }
94
95 inline Vec2ui operator + (const Vec2ui& rhs) const
96 {
97 return Vec2ui(_v[0]+rhs._v[0], _v[1]+rhs._v[1]);
98 }
99
100 inline Vec2ui operator - (const Vec2ui& rhs) const
101 {
102 return Vec2ui(_v[0]-rhs._v[0], _v[1]-rhs._v[1]);
103 }
104
105 inline Vec2ui operator * (const Vec2ui& rhs) const
106 {
107 return Vec2ui(_v[0]*rhs._v[0], _v[1]*rhs._v[1]);
108 }
109
110};
111
112}
113
114#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
value_type & y()
Definition Vec2ui:64
value_type g() const
Definition Vec2ui:73
value_type y() const
Definition Vec2ui:67
void set(value_type x, value_type y)
Definition Vec2ui:50
Vec2ui operator*(value_type rhs) const
Definition Vec2ui:75
value_type r() const
Definition Vec2ui:72
unsigned int value_type
Type of Vec class.
Definition Vec2ui:26
value_type & g()
Definition Vec2ui:70
Vec2ui operator+(value_type rhs) const
Definition Vec2ui:85
value_type * ptr()
Definition Vec2ui:47
value_type _v[2]
Vec member variable.
Definition Vec2ui:32
const value_type * ptr() const
Definition Vec2ui:48
Vec2ui operator/(value_type rhs) const
Definition Vec2ui:80
value_type & x()
Definition Vec2ui:63
value_type & r()
Definition Vec2ui:69
Vec2ui()
Definition Vec2ui:34
bool operator!=(const Vec2ui &v) const
Definition Vec2ui:39
bool operator<(const Vec2ui &v) const
Definition Vec2ui:40
Vec2ui operator-(value_type rhs) const
Definition Vec2ui:90
Vec2ui(value_type x, value_type y)
Definition Vec2ui:36
void set(const Vec2ui &rhs)
Definition Vec2ui:55
value_type & operator[](int i)
Definition Vec2ui:60
value_type x() const
Definition Vec2ui:66
@ num_components
Definition Vec2ui:29
bool operator==(const Vec2ui &v) const
Definition Vec2ui:38

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.