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

SbVec2d.h
1#ifndef COIN_SBVEC2D_H
2#define COIN_SBVEC2D_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
29#include <Inventor/SbBasic.h>
30
31class SbVec2f;
32class SbVec2b;
33class SbVec2s;
34class SbVec2i32;
35
36class COIN_DLL_API SbVec2d {
37public:
38 SbVec2d(void);
39 SbVec2d(const double v[2]);
40 SbVec2d(const double x, const double y);
41 explicit SbVec2d(const SbVec2f & v) { setValue(v); }
42 explicit SbVec2d(const SbVec2b & v) { setValue(v); }
43 explicit SbVec2d(const SbVec2s & v) { setValue(v); }
44 explicit SbVec2d(const SbVec2i32 & v) { setValue(v); }
45
46 SbVec2d & setValue(const double v[2]);
47 SbVec2d & setValue(const double x, const double y);
48 SbVec2d & setValue(const SbVec2f & v);
49 SbVec2d & setValue(const SbVec2b & v);
50 SbVec2d & setValue(const SbVec2s & v);
51 SbVec2d & setValue(const SbVec2i32 & v);
52
53 double & operator [] (const int i);
54 const double & operator [] (const int i) const;
55
56 double dot(const SbVec2d & v) const;
57 SbBool equals(const SbVec2d & v, const double tolerance) const;
58 const double * getValue(void) const;
59 void getValue(double & x, double & y) const;
60 double length(void) const;
61 double sqrLength(void) const;
62 void negate(void);
63 double normalize(void);
64 SbVec2d & operator *= (const double d);
65 SbVec2d & operator /= (const double d);
66 SbVec2d & operator += (const SbVec2d & u);
67 SbVec2d & operator -= (const SbVec2d & u);
68 SbVec2d operator -(void) const;
69
70 friend COIN_DLL_API SbVec2d operator * (const SbVec2d & v, const double d);
71 friend COIN_DLL_API SbVec2d operator * (const double d, const SbVec2d & v);
72 friend COIN_DLL_API SbVec2d operator / (const SbVec2d & v, const double d);
73 friend COIN_DLL_API SbVec2d operator + (const SbVec2d & v1, const SbVec2d & v2);
74 friend COIN_DLL_API SbVec2d operator - (const SbVec2d & v1, const SbVec2d & v2);
75 friend COIN_DLL_API int operator == (const SbVec2d & v1, const SbVec2d & v2);
76 friend COIN_DLL_API int operator != (const SbVec2d & v1, const SbVec2d & v2);
77
78 void print(FILE * fp) const;
79
80private:
81 double vec[2];
82};
83
84COIN_DLL_API SbVec2d operator * (const SbVec2d & v, const double d);
85COIN_DLL_API SbVec2d operator * (const double d, const SbVec2d & v);
86COIN_DLL_API SbVec2d operator / (const SbVec2d & v, const double d);
87COIN_DLL_API SbVec2d operator + (const SbVec2d & v1, const SbVec2d & v2);
88COIN_DLL_API SbVec2d operator - (const SbVec2d & v1, const SbVec2d & v2);
89COIN_DLL_API int operator == (const SbVec2d & v1, const SbVec2d & v2);
90COIN_DLL_API int operator != (const SbVec2d & v1, const SbVec2d & v2);
91
92
93// *************************************************************************
94
95//$ IMPORT INLINE ../../src/SbVec2d.cpp
96
97// *************************************************************************
98
99#endif // !COIN_SBVEC2D_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
SbVec2d(const SbVec2b &v)
Definition SbVec2d.h:42
SbVec2d(const SbVec2i32 &v)
Definition SbVec2d.h:44
SbVec2d(const SbVec2s &v)
Definition SbVec2d.h:43
SbVec2d(const SbVec2f &v)
Definition SbVec2d.h:41
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

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

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