![]() |
http://www.sim.no http://www.coin3d.org |
00001 #ifndef COIN_SBVEC2F_H 00002 #define COIN_SBVEC2F_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 SbVec2d; 00032 class SbVec2b; 00033 class SbVec2s; 00034 class SbVec2i32; 00035 00036 class COIN_DLL_API SbVec2f { 00037 public: 00038 SbVec2f(void); 00039 SbVec2f(const float v[2]); 00040 SbVec2f(const float x, const float y); 00041 explicit SbVec2f(const SbVec2d & v) { setValue(v); } 00042 explicit SbVec2f(const SbVec2b & v) { setValue(v); } 00043 explicit SbVec2f(const SbVec2s & v) { setValue(v); } 00044 explicit SbVec2f(const SbVec2i32 & v) { setValue(v); } 00045 00046 SbVec2f & setValue(const float v[2]); 00047 SbVec2f & setValue(const float x, const float y); 00048 SbVec2f & setValue(const SbVec2d & v); 00049 SbVec2f & setValue(const SbVec2b & v); 00050 SbVec2f & setValue(const SbVec2s & v); 00051 SbVec2f & setValue(const SbVec2i32 & v); 00052 00053 float dot(const SbVec2f & v) const; 00054 SbBool equals(const SbVec2f & v, const float tolerance) const; 00055 const float * getValue(void) const; 00056 void getValue(float & x, float & y) const; 00057 float length(void) const; 00058 float sqrLength(void) const; 00059 void negate(void); 00060 float normalize(void); 00061 float & operator [] (const int i); 00062 const float & operator [] (const int i) const; 00063 SbVec2f & operator *= (const float d); 00064 SbVec2f & operator /= (const float d); 00065 SbVec2f & operator += (const SbVec2f & u); 00066 SbVec2f & operator -= (const SbVec2f & u); 00067 SbVec2f operator-(void) const; 00068 00069 friend COIN_DLL_API SbVec2f operator * (const SbVec2f & v, const float d); 00070 friend COIN_DLL_API SbVec2f operator * (const float d, const SbVec2f & v); 00071 friend COIN_DLL_API SbVec2f operator / (const SbVec2f & v, const float d); 00072 friend COIN_DLL_API SbVec2f operator + (const SbVec2f & v1, const SbVec2f & v2); 00073 friend COIN_DLL_API SbVec2f operator - (const SbVec2f & v1, const SbVec2f & v2); 00074 friend COIN_DLL_API int operator == (const SbVec2f & v1, const SbVec2f & v2); 00075 friend COIN_DLL_API int operator != (const SbVec2f & v1, const SbVec2f & v2); 00076 00077 void print(FILE * fp) const; 00078 00079 private: 00080 float vec[2]; 00081 }; 00082 00083 COIN_DLL_API SbVec2f operator * (const SbVec2f & v, const float d); 00084 COIN_DLL_API SbVec2f operator * (const float d, const SbVec2f & v); 00085 COIN_DLL_API SbVec2f operator / (const SbVec2f & v, const float d); 00086 COIN_DLL_API SbVec2f operator + (const SbVec2f & v1, const SbVec2f & v2); 00087 COIN_DLL_API SbVec2f operator - (const SbVec2f & v1, const SbVec2f & v2); 00088 COIN_DLL_API int operator == (const SbVec2f & v1, const SbVec2f & v2); 00089 COIN_DLL_API int operator != (const SbVec2f & v1, const SbVec2f & v2); 00090 00091 // ************************************************************************* 00092 00093 #endif // !COIN_SBVEC2F_H
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 23 16:33:10 2009 for Coin by Doxygen. 1.5.8