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

SbVec4f.h

00001 #ifndef COIN_SBVEC4F_H
00002 #define COIN_SBVEC4F_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <stdio.h>
00028 
00029 #include <Inventor/SbBasic.h>
00030 
00031 class SbVec4d;
00032 class SbVec3f;
00033 
00034 class COIN_DLL_API SbVec4f {
00035 public:
00036   SbVec4f(void);
00037   SbVec4f(const float v[4]);
00038   SbVec4f(const float x, const float y, const float z, const float w);
00039   explicit SbVec4f(const SbVec4d & v) { setValue(v); }
00040   float dot(const SbVec4f& v) const;
00041   SbBool equals(const SbVec4f& v, const float tolerance) const;
00042   void getReal(SbVec3f& v) const;
00043   const float * getValue(void) const;
00044   void getValue(float & x, float & y, float & z, float & w) const;
00045   float length(void) const;
00046   float sqrLength(void) const;
00047   void negate(void);
00048   float normalize(void);
00049   SbVec4f& setValue(const float v[4]);
00050   SbVec4f& setValue(const float x, const float y, const float z,
00051                     const float w);
00052   SbVec4f & setValue(const SbVec4d & v);
00053   float& operator [](const int i);
00054   const float& operator [](const int i) const;
00055   SbVec4f& operator *=(const float d);
00056   SbVec4f& operator /=(const float d);
00057   SbVec4f& operator +=(const SbVec4f& u);
00058   SbVec4f& operator -=(const SbVec4f& u);
00059   SbVec4f operator-(void) const;
00060   friend COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
00061   friend COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
00062   friend COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
00063   friend COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
00064   friend COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
00065   friend COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
00066   friend COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
00067 
00068   void print(FILE * fp) const;
00069 
00070 private: // protected
00071   float vec[4];
00072 };
00073 
00074 COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
00075 COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
00076 COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
00077 COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
00078 COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
00079 COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
00080 COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
00081 
00082 #endif // !COIN_SBVEC4F_H

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

Generated on Mon Feb 28 2011 10:11:53 for Coin by Doxygen. 1.7.3