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

SbVec3s.h

00001 #ifndef COIN_SBVEC3S_H
00002 #define COIN_SBVEC3S_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 #include <Inventor/SbBasic.h>
00029 
00030 class COIN_DLL_API SbVec3s {
00031 public:
00032   SbVec3s(void);
00033   SbVec3s(const short v[3]);
00034   SbVec3s(const short x, const short y, const short z);
00035 
00036   int32_t dot(const SbVec3s & v) const;
00037   const short * getValue(void) const;
00038   void getValue(short & x, short & y, short & z) const;
00039   void negate(void);
00040   SbVec3s & setValue(const short v[3]);
00041   SbVec3s & setValue(const short x, const short y, const short z);
00042 
00043   short & operator [](const int i);
00044   const short & operator [](const int i) const;
00045   SbVec3s & operator *=(int d);
00046   SbVec3s & operator *=(double  d);
00047   SbVec3s & operator /=(int d);
00048   SbVec3s & operator /=(double d);
00049   SbVec3s & operator +=(const SbVec3s & u);
00050   SbVec3s & operator -=(const SbVec3s & u);
00051   SbVec3s operator-(void) const;
00052   friend COIN_DLL_API SbVec3s operator *(const SbVec3s & v, int d);
00053   friend COIN_DLL_API SbVec3s operator *(const SbVec3s & v, double d);
00054   friend COIN_DLL_API SbVec3s operator *(int d, const SbVec3s & v);
00055   friend COIN_DLL_API SbVec3s operator *(double d, const SbVec3s & v);
00056   friend COIN_DLL_API SbVec3s operator /(const SbVec3s & v, int d);
00057   friend COIN_DLL_API SbVec3s operator /(const SbVec3s & v, double d);
00058   friend COIN_DLL_API SbVec3s operator +(const SbVec3s & v1, const SbVec3s & v2);
00059   friend COIN_DLL_API SbVec3s operator -(const SbVec3s & v1, const SbVec3s & v2);
00060   friend COIN_DLL_API int operator ==(const SbVec3s & v1, const SbVec3s & v2);
00061   friend COIN_DLL_API int operator !=(const SbVec3s & v1, const SbVec3s & v2);
00062 
00063   void print(FILE * fp) const;
00064 
00065 private:
00066   short vec[3];
00067 };
00068 
00069 COIN_DLL_API SbVec3s operator *(const SbVec3s & v, int d);
00070 COIN_DLL_API SbVec3s operator *(const SbVec3s & v, double d);
00071 COIN_DLL_API SbVec3s operator *(int d, const SbVec3s & v);
00072 COIN_DLL_API SbVec3s operator *(double d, const SbVec3s & v);
00073 COIN_DLL_API SbVec3s operator /(const SbVec3s & v, int d);
00074 COIN_DLL_API SbVec3s operator /(const SbVec3s & v, double d);
00075 COIN_DLL_API SbVec3s operator +(const SbVec3s & v1, const SbVec3s & v2);
00076 COIN_DLL_API SbVec3s operator -(const SbVec3s & v1, const SbVec3s & v2);
00077 COIN_DLL_API int operator ==(const SbVec3s & v1, const SbVec3s & v2);
00078 COIN_DLL_API int operator !=(const SbVec3s & v1, const SbVec3s & v2);
00079 
00080 /* inlined methods ********************************************************/
00081 
00082 inline short &
00083 SbVec3s::operator [](const int i)
00084 {
00085   return this->vec[i];
00086 }
00087 
00088 inline const short &
00089 SbVec3s::operator [](const int i) const
00090 {
00091   return this->vec[i];
00092 }
00093 
00094 #endif // !COIN_SBVEC3S_H

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

Generated on Sun Apr 15 03:31:48 2007 for Coin by Doxygen. 1.5.2