1
/**************************************************************************\
3
* This file is part of the Coin 3D visualization library.
4
* Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* ("GPL") version 2 as published by the Free Software Foundation.
9
* See the file LICENSE.GPL at the root directory of this source
10
* distribution for additional information about the GNU GPL.
12
* For using Coin with software that can not be combined with the GNU
13
* GPL, and for taking advantage of the additional benefits of our
14
* support services, please contact Systems in Motion about acquiring
15
* a Coin Professional Edition License.
17
* See http://www.coin3d.org/ for more information.
19
* Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
22
\**************************************************************************/
24
#include <Inventor/SbVec4ub.h>
26
#include <Inventor/SbVec4b.h>
27
#include <Inventor/SbVec4us.h>
28
#include <Inventor/SbVec4ui32.h>
31
\class SbVec4ub SbVec4ub.h Inventor/SbVec4ub.h
33
\brief The SbVec4ub class is a 4 dimensional vector with unsigned
34
8-bit integer coordinates.
38
This vector class provides storage for a 3 dimensional homogeneoues
39
vector (with the 4 components usually referred to as <x, y, z, w>)
40
aswell as simple integer precision arithmetic operations.
42
\sa SbVec2ub, SbVec3ub, SbVec4b, SbVec4s, SbVec4us, SbVec4i32, SbVec4ui32
48
Sets this vector to the 8-bit integer precision vector \a v,
49
converting the vector to a unsigned 8-bit integer precision vector.
52
SbVec4ub::setValue(const SbVec4b & v)
54
vec[0] = static_cast<uint8_t>(v[0]);
55
vec[1] = static_cast<uint8_t>(v[1]);
56
vec[2] = static_cast<uint8_t>(v[2]);
57
vec[3] = static_cast<uint8_t>(v[3]);
62
Sets this vector to the unsigned short integer precision vector \a
63
v, converting the vector to a unsigned 8-bit integer precision vector.
66
SbVec4ub::setValue(const SbVec4us & v)
68
vec[0] = static_cast<uint8_t>(v[0]);
69
vec[1] = static_cast<uint8_t>(v[1]);
70
vec[2] = static_cast<uint8_t>(v[2]);
71
vec[3] = static_cast<uint8_t>(v[3]);
76
Sets this vector to the unsigned 32-bit integer precision vector \a
77
v, converting the vector to a unsigned 8-bit integer precision vector.
80
SbVec4ub::setValue(const SbVec4ui32 & v)
82
vec[0] = static_cast<uint8_t>(v[0]);
83
vec[1] = static_cast<uint8_t>(v[1]);
84
vec[2] = static_cast<uint8_t>(v[2]);
85
vec[3] = static_cast<uint8_t>(v[3]);
90
Negate the vector (i.e. point it in the opposite direction)
93
SbVec4ub::negate(void)
95
vec[0] = static_cast<uint8_t>(-vec[0]);
96
vec[1] = static_cast<uint8_t>(-vec[1]);
97
vec[2] = static_cast<uint8_t>(-vec[2]);
98
vec[3] = static_cast<uint8_t>(-vec[3]);
103
Multiply components of vector with value \a d. Returns reference
107
SbVec4ub::operator *= (double d)
109
vec[0] = static_cast<uint8_t>(vec[0] * d);
110
vec[1] = static_cast<uint8_t>(vec[1] * d);
111
vec[2] = static_cast<uint8_t>(vec[2] * d);
112
vec[3] = static_cast<uint8_t>(vec[3] * d);
117
\fn SbVec4ub::SbVec4ub(void)
119
The default constructor does nothing. The vector coordinates will be
120
uninitialized until a call the setValue().
124
\fn SbVec4ub::SbVec4ub(const uint8_t v[4])
126
Constructs an SbVec4ub instance with initial values from \a v.
130
\fn SbVec4ub::SbVec4ub(uint8_t x, uint8_t y, uint8_t z, uint8_t w)
132
Constructs an SbVec4ub instance with the initial homogeneous vector
137
\fn explicit SbVec4ub::SbVec4ub(const SbVec4b & v)
139
Constructs an SbVec4ub instance with initial values from the 8-bit
140
integer precision vector \a v.
144
\fn explicit SbVec4ub::SbVec4ub(const SbVec4us & v)
146
Constructs an SbVec4ub instance with initial values from the
147
unsigned short integer precision vector \a v.
151
\fn explicit SbVec4ub::SbVec4ub(const SbVec4ui32 & v)
153
Constructs an SbVec4ub instance with initial values from the
154
unsigned 32-bit integer precision vector \a v.
158
\fn SbVec4ub & SbVec4ub::setValue(const uint8_t v[4])
160
Set new coordinates for the vector from \a v. Returns reference to
167
\fn SbVec4ub & SbVec4ub::setValue(uint8_t x, uint8_t y, uint8_t z, uint8_t w)
169
Set new coordinates for the vector. Returns reference to self.
175
\fn const uint8_t * SbVec4ub::getValue(void) const
177
Returns a pointer to an array of four uint8_t integers
178
containing the x, y, z and w coordinates of the vector.
184
\fn void SbVec4ub::getValue(uint8_t & x, uint8_t & y, uint8_t & z, uint8_t & w) const
186
Returns the x, y, z and w coordinates of the vector.
190
\fn uint8_t & SbVec4ub::operator [] (int i)
192
Index operator. Returns modifiable x, y, z or w coordinate of the
196
\fn const uint8_t & SbVec4ub::operator [] (int i) const
198
Index operator. Returns non-modifiable x, y, z or w coordinate of
203
\fn int32_t SbVec4ub::dot(SbVec4ub v) const
205
Calculates and returns the result of taking the dot product of this
210
\fn void SbVec4ub::negate(void)
212
Negate the vector (i.e. point it in the opposite direction)
216
\fn SbVec4ub & SbVec4ub::operator *= (int d)
218
Multiply components of vector with scalar value \a d. Returns
223
\fn SbVec4ub & SbVec4ub::operator /= (int d)
225
Divides components of vector with scalar value \a d. Returns
230
\fn SbVec4ub & SbVec4ub::operator /= (double d)
232
Divides components of vector with scalar value \a d. Returns
237
\fn SbVec4ub & SbVec4ub::operator += (SbVec4ub v)
239
Adds this vector and vector \a u. Returns reference to self.
243
\fn SbVec4ub & SbVec4ub::operator -= (SbVec4ub v)
245
Subtracts \a v from this vector. Returns reference to self.
248
\fn SbVec4ub SbVec4ub::operator - (void) const
250
Non-destructive negation operator. Returns a new SbVec4ub instance
251
which points in the opposite direction of this vector.