Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members

# 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-2003 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 <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <stdio.h>
    00028
    00029 #include <Inventor/SbBasic.h>
    00030
    00031 class SbVec3f;
    00032
    00033 class COIN_DLL_API SbVec4f {
    00034 public:
    00035   SbVec4f(void);
    00036   SbVec4f(const float v[4]);
    00037   SbVec4f(const float x, const float y, const float z, const float w);
    00038   float dot(const SbVec4f& v) const;
    00039   SbBool equals(const SbVec4f& v, const float tolerance) const;
    00040   void getReal(SbVec3f& v) const;
    00041   const float* getValue(void) const;
    00042   void getValue(float& x, float& y, float& z, float& w) const;
    00043   float length(void) const;
    00044   void negate(void);
    00045   float normalize(void);
    00046   SbVec4f& setValue(const float v[4]);
    00047   SbVec4f& setValue(const float x, const float y, const float z,
    00048                     const float w);
    00049   float& operator [](const int i);
    00050   const float& operator [](const int i) const;
    00051   SbVec4f& operator *=(const float d);
    00052   SbVec4f& operator /=(const float d);
    00053   SbVec4f& operator +=(const SbVec4f& u);
    00054   SbVec4f& operator -=(const SbVec4f& u);
    00055   SbVec4f operator-(void) const;
    00056   friend COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
    00057   friend COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
    00058   friend COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
    00059   friend COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
    00060   friend COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
    00061   friend COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
    00062   friend COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
    00063
    00064   void print(FILE * fp) const;
    00065
    00066 private:
    00067   float vec[4];
    00068 };
    00069
    00070 COIN_DLL_API SbVec4f operator *(const SbVec4f& v, const float d);
    00071 COIN_DLL_API SbVec4f operator *(const float d, const SbVec4f& v);
    00072 COIN_DLL_API SbVec4f operator /(const SbVec4f& v, const float d);
    00073 COIN_DLL_API SbVec4f operator +(const SbVec4f& v1, const SbVec4f& v2);
    00074 COIN_DLL_API SbVec4f operator -(const SbVec4f& v1, const SbVec4f& v2);
    00075 COIN_DLL_API int operator ==(const SbVec4f& v1, const SbVec4f& v2);
    00076 COIN_DLL_API int operator !=(const SbVec4f& v1, const SbVec4f& v2);
    00077
    00078 #endif // !COIN_SBVEC4F_H