Coin Logo http://www.sim.no
http://www.coin3d.org

SbVec3s.h
1#ifndef COIN_SBVEC3S_H
2#define COIN_SBVEC3S_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Systems in Motion about acquiring
18 * a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <stdio.h>
28#include <Inventor/SbBasic.h>
29
30class SbVec3us;
31class SbVec3b;
32class SbVec3i32;
33class SbVec3f;
34class SbVec3d;
35
36class COIN_DLL_API SbVec3s {
37public:
38 SbVec3s(void);
39 SbVec3s(const short v[3]);
40 SbVec3s(const short x, const short y, const short z);
41 explicit SbVec3s(const SbVec3us & v) { setValue(v); }
42 explicit SbVec3s(const SbVec3b & v) { setValue(v); }
43 explicit SbVec3s(const SbVec3i32 & v) { setValue(v); }
44 explicit SbVec3s(const SbVec3f & v) { setValue(v); }
45 explicit SbVec3s(const SbVec3d & v) { setValue(v); }
46
47 int32_t dot(const SbVec3s & v) const;
48 const short * getValue(void) const;
49 void getValue(short & x, short & y, short & z) const;
50 void negate(void);
51 SbVec3s & setValue(const short v[3]);
52 SbVec3s & setValue(const short x, const short y, const short z);
53 SbVec3s & setValue(const SbVec3us & v);
54 SbVec3s & setValue(const SbVec3b & v);
55 SbVec3s & setValue(const SbVec3i32 & v);
56 SbVec3s & setValue(const SbVec3f & v);
57 SbVec3s & setValue(const SbVec3d & v);
58
59 short & operator [](const int i);
60 const short & operator [](const int i) const;
61 SbVec3s & operator *=(int d);
62 SbVec3s & operator *=(double d);
63 SbVec3s & operator /=(int d);
64 SbVec3s & operator /=(double d);
65 SbVec3s & operator +=(const SbVec3s & u);
66 SbVec3s & operator -=(const SbVec3s & u);
67 SbVec3s operator-(void) const;
68 friend COIN_DLL_API SbVec3s operator *(const SbVec3s & v, int d);
69 friend COIN_DLL_API SbVec3s operator *(const SbVec3s & v, double d);
70 friend COIN_DLL_API SbVec3s operator *(int d, const SbVec3s & v);
71 friend COIN_DLL_API SbVec3s operator *(double d, const SbVec3s & v);
72 friend COIN_DLL_API SbVec3s operator /(const SbVec3s & v, int d);
73 friend COIN_DLL_API SbVec3s operator /(const SbVec3s & v, double d);
74 friend COIN_DLL_API SbVec3s operator +(const SbVec3s & v1, const SbVec3s & v2);
75 friend COIN_DLL_API SbVec3s operator -(const SbVec3s & v1, const SbVec3s & v2);
76 friend COIN_DLL_API int operator ==(const SbVec3s & v1, const SbVec3s & v2);
77 friend COIN_DLL_API int operator !=(const SbVec3s & v1, const SbVec3s & v2);
78
79 void print(FILE * fp) const;
80
81private:
82 short vec[3];
83};
84
85COIN_DLL_API SbVec3s operator *(const SbVec3s & v, int d);
86COIN_DLL_API SbVec3s operator *(const SbVec3s & v, double d);
87COIN_DLL_API SbVec3s operator *(int d, const SbVec3s & v);
88COIN_DLL_API SbVec3s operator *(double d, const SbVec3s & v);
89COIN_DLL_API SbVec3s operator /(const SbVec3s & v, int d);
90COIN_DLL_API SbVec3s operator /(const SbVec3s & v, double d);
91COIN_DLL_API SbVec3s operator +(const SbVec3s & v1, const SbVec3s & v2);
92COIN_DLL_API SbVec3s operator -(const SbVec3s & v1, const SbVec3s & v2);
93COIN_DLL_API int operator ==(const SbVec3s & v1, const SbVec3s & v2);
94COIN_DLL_API int operator !=(const SbVec3s & v1, const SbVec3s & v2);
95
96/* inlined methods ********************************************************/
97
98inline short &
100{
101 return this->vec[i];
102}
103
104inline const short &
105SbVec3s::operator [](const int i) const
106{
107 return this->vec[i];
108}
109
110#endif // !COIN_SBVEC3S_H
The SbVec3b class is a 3 dimensional vector with 8-bit integer coordinates.
Definition SbVec3b.h:37
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.
Definition SbVec3d.h:35
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:37
The SbVec3i32 class is a 3 dimensional vector with 32-bit integer coordinates.
Definition SbVec3i32.h:39
The SbVec3s class is a 3 dimensional vector with short integer coordinates.
Definition SbVec3s.h:36
SbVec3s & setValue(const short v[3])
Definition SbVec3s.cpp:205
SbVec3s(const SbVec3us &v)
Definition SbVec3s.h:41
SbVec3s(const SbVec3d &v)
Definition SbVec3s.h:45
SbVec3s(void)
Definition SbVec3s.cpp:82
short & operator[](const int i)
Definition SbVec3s.h:99
SbVec3s(const SbVec3i32 &v)
Definition SbVec3s.h:43
SbVec3s(const SbVec3b &v)
Definition SbVec3s.h:42
SbVec3s(const SbVec3f &v)
Definition SbVec3s.h:44
The SbVec3us class is a 3 dimensional vector with unsigned short integer coordinates.
Definition SbVec3us.h:37

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Thu Jan 16 2025 for Coin by Doxygen. 1.13.2