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

# SbVec2s.h

    00001 #ifndef COIN_SBVEC2S_H
    00002 #define COIN_SBVEC2S_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 #include <Inventor/SbBasic.h>
    00029 #include <Inventor/system/inttypes.h>
    00030
    00031
    00032 class COIN_DLL_API SbVec2s {
    00033 public:
    00034   SbVec2s(void);
    00035   SbVec2s(const short v[2]);
    00036   SbVec2s(const short x, const short y);
    00037   int32_t dot(const SbVec2s& v) const;
    00038   const short * getValue(void) const;
    00039   void getValue(short& x, short& y) const;
    00040   void negate(void);
    00041   SbVec2s& setValue(const short v[2]);
    00042   SbVec2s& setValue(short x, short y);
    00043   short& operator [](const int i);
    00044   const short& operator [](const int i) const;
    00045   SbVec2s& operator *=(int d);
    00046   SbVec2s& operator *=(double d);
    00047   SbVec2s& operator /=(int d);
    00048   SbVec2s& operator /=(double d);
    00049   SbVec2s& operator +=(const SbVec2s& u);
    00050   SbVec2s& operator -=(const SbVec2s& u);
    00051   SbVec2s operator-(void) const;
    00052   friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
    00053   friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
    00054   friend COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
    00055   friend COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
    00056   friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
    00057   friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
    00058   friend COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
    00059   friend COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
    00060   friend COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
    00061   friend COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
    00062
    00063   void print(FILE * fp) const;
    00064
    00065 private:
    00066   short vec[2];
    00067 };
    00068
    00069 COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
    00070 COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
    00071 COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
    00072 COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
    00073 COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
    00074 COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
    00075 COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
    00076 COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
    00077 COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
    00078 COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
    00079
    00080 #endif // !COIN_SBVEC2S_H