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

SbVec2s.h
1#ifndef COIN_SBVEC2S_H
2#define COIN_SBVEC2S_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#include <Inventor/system/inttypes.h>
30
31class SbVec2us;
32class SbVec2b;
33class SbVec2i32;
34class SbVec2f;
35class SbVec2d;
36
37class COIN_DLL_API SbVec2s {
38public:
39 SbVec2s(void);
40 SbVec2s(const short v[2]);
41 SbVec2s(const short x, const short y);
42 explicit SbVec2s(const SbVec2us & v) { setValue(v); }
43 explicit SbVec2s(const SbVec2b & v) { setValue(v); }
44 explicit SbVec2s(const SbVec2i32 & v) { setValue(v); }
45 explicit SbVec2s(const SbVec2f & v) { setValue(v); }
46 explicit SbVec2s(const SbVec2d & v) { setValue(v); }
47
48 int32_t dot(const SbVec2s& v) const;
49 const short * getValue(void) const;
50 void getValue(short& x, short& y) const;
51 void negate(void);
52 SbVec2s& setValue(const short v[2]);
53 SbVec2s& setValue(short x, short y);
54 SbVec2s & setValue(const SbVec2us & v);
55 SbVec2s & setValue(const SbVec2b & v);
56 SbVec2s & setValue(const SbVec2i32 & v);
57 SbVec2s & setValue(const SbVec2f & v);
58 SbVec2s & setValue(const SbVec2d & v);
59 short& operator [](const int i);
60 const short& operator [](const int i) const;
61 SbVec2s& operator *=(int d);
62 SbVec2s& operator *=(double d);
63 SbVec2s& operator /=(int d);
64 SbVec2s& operator /=(double d);
65 SbVec2s& operator +=(const SbVec2s& u);
66 SbVec2s& operator -=(const SbVec2s& u);
67 SbVec2s operator-(void) const;
68 friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
69 friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
70 friend COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
71 friend COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
72 friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
73 friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
74 friend COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
75 friend COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
76 friend COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
77 friend COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
78
79 void print(FILE * fp) const;
80
81private:
82 short vec[2];
83};
84
85COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
86COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
87COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
88COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
89COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
90COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
91COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
92COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
93COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
94COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
95
96#endif // !COIN_SBVEC2S_H
The SbVec2b class is a 2 dimensional vector with 8-bit integer coordinates.
Definition SbVec2b.h:37
The SbVec2d class is a 2 dimensional vector with double precision floating point coordinates.
Definition SbVec2d.h:36
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:36
The SbVec2i32 class is a 2 dimensional vector with 32-bit integer coordinates.
Definition SbVec2i32.h:39
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:37
SbVec2s(const SbVec2b &v)
Definition SbVec2s.h:43
SbVec2s(const SbVec2i32 &v)
Definition SbVec2s.h:44
SbVec2s(const SbVec2f &v)
Definition SbVec2s.h:45
SbVec2s(const SbVec2d &v)
Definition SbVec2s.h:46
SbVec2s(const SbVec2us &v)
Definition SbVec2s.h:42
The SbVec2us class is a 2 dimensional vector with unsigned short integer coordinates.
Definition SbVec2us.h:37

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

Generated on Wed Jul 17 2024 for Coin by Doxygen. 1.12.0