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

SbVec4f.h
1 #ifndef COIN_SBVEC4F_H
2 #define COIN_SBVEC4F_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 
31 class SbVec4d;
32 class SbVec3f;
33 
34 class COIN_DLL_API SbVec4f {
35 public:
36  SbVec4f(void);
37  SbVec4f(const float v[4]);
38  SbVec4f(const float x, const float y, const float z, const float w);
39  explicit SbVec4f(const SbVec4d & v) { setValue(v); }
40  float dot(const SbVec4f& v) const;
41  SbBool equals(const SbVec4f& v, const float tolerance) const;
42  void getReal(SbVec3f& v) const;
43  const float * getValue(void) const;
44  void getValue(float & x, float & y, float & z, float & w) const;
45  float length(void) const;
46  float sqrLength(void) const;
47  void negate(void);
48  float normalize(void);
49  SbVec4f& setValue(const float v[4]);
50  SbVec4f& setValue(const float x, const float y, const float z,
51  const float w);
52  SbVec4f & setValue(const SbVec4d & v);
53  float& operator [](const int i);
54  const float& operator [](const int i) const;
55  SbVec4f& operator *=(const float d);
56  SbVec4f& operator /=(const float d);
57  SbVec4f& operator +=(const SbVec4f& u);
58  SbVec4f& operator -=(const SbVec4f& u);
59  SbVec4f operator-(void) const;
60  friend COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
61  friend COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
62  friend COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
63  friend COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
64  friend COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
65  friend COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
66  friend COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
67 
68  void print(FILE * fp) const;
69 
70 private: // protected
71  float vec[4];
72 };
73 
74 COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
75 COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
76 COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
77 COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
78 COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
79 COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
80 COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
81 
82 #endif // !COIN_SBVEC4F_H
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition: SbVec4f.h:34
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
The SbVec4d class is a 4 dimensional vector with double precision floating point coordinates.
Definition: SbVec4d.h:34
SbVec4f(const SbVec4d &v)
Definition: SbVec4f.h:39

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

Generated on Fri Feb 17 2017 for Coin by Doxygen. 1.8.13