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

SbVec3f.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SBVEC3F_H
00021 #define COIN_SBVEC3F_H
00022 
00023 #include <stdio.h>
00024 
00025 #include <Inventor/SbBasic.h>
00026 
00027 class SbPlane;
00028 
00029 class COIN_DLL_API SbVec3f {
00030 public:
00031   SbVec3f(void);
00032   SbVec3f(const float v[3]);
00033   SbVec3f(const float x, const float y, const float z);
00034   SbVec3f(const SbPlane & p0, const SbPlane & p1, const SbPlane & p2);
00035   SbVec3f cross(const SbVec3f & v) const;
00036   float dot(const SbVec3f & v) const;
00037   SbBool equals(const SbVec3f & v, const float tolerance) const;
00038   SbVec3f getClosestAxis(void) const;
00039   const float * getValue(void) const;
00040   void getValue(float & x, float & y, float & z) const;
00041   float length(void) const;
00042   float sqrLength() const;
00043   void negate(void);
00044   float normalize(void);
00045   SbVec3f & setValue(const float v[3]);
00046   SbVec3f & setValue(const float x, const float y, const float z);
00047   SbVec3f & setValue(const SbVec3f & barycentric,
00048                      const SbVec3f & v0,
00049                      const SbVec3f & v1,
00050                      const SbVec3f & v2);
00051   float & operator [](const int i);
00052   const float & operator [](const int i) const;
00053   SbVec3f & operator *=(const float d);
00054   SbVec3f & operator /=(const float d);
00055   SbVec3f & operator +=(const SbVec3f & u);
00056   SbVec3f & operator -=(const SbVec3f & u);
00057   SbVec3f operator -(void) const;
00058   friend COIN_DLL_API SbVec3f operator *(const SbVec3f & v, const float d);
00059   friend COIN_DLL_API SbVec3f operator *(const float d, const SbVec3f & v);
00060   friend COIN_DLL_API SbVec3f operator /(const SbVec3f & v, const float d);
00061   friend COIN_DLL_API SbVec3f operator +(const SbVec3f & v1, const SbVec3f & v2);
00062   friend COIN_DLL_API SbVec3f operator -(const SbVec3f & v1, const SbVec3f & v2);
00063   friend COIN_DLL_API int operator ==(const SbVec3f & v1, const SbVec3f & v2);
00064   friend COIN_DLL_API int operator !=(const SbVec3f & v1, const SbVec3f & v2);
00065 
00066   void print(FILE * fp) const;
00067 
00068 private:
00069   float vec[3];
00070 };
00071 
00072 COIN_DLL_API SbVec3f operator *(const SbVec3f & v, const float d);
00073 COIN_DLL_API SbVec3f operator *(const float d, const SbVec3f & v);
00074 COIN_DLL_API SbVec3f operator /(const SbVec3f & v, const float d);
00075 COIN_DLL_API SbVec3f operator +(const SbVec3f & v1, const SbVec3f & v2);
00076 COIN_DLL_API SbVec3f operator -(const SbVec3f & v1, const SbVec3f & v2);
00077 COIN_DLL_API int operator ==(const SbVec3f & v1, const SbVec3f & v2);
00078 COIN_DLL_API int operator !=(const SbVec3f & v1, const SbVec3f & v2);
00079 
00080 
00081 /* inlined methods ********************************************************/
00082 
00083 inline float &
00084 SbVec3f::operator [](const int i)
00085 {
00086   return this->vec[i];
00087 }
00088 
00089 inline const float &
00090 SbVec3f::operator [](const int i) const
00091 {
00092   return this->vec[i];
00093 }
00094 
00095 
00096 #endif // !COIN_SBVEC3F_H

Generated at Tue Mar 5 03:31:11 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001