From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/agent__3dvector_8h-source.html | 327 ++++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 docs/doxygen/nel/agent__3dvector_8h-source.html (limited to 'docs/doxygen/nel/agent__3dvector_8h-source.html') diff --git a/docs/doxygen/nel/agent__3dvector_8h-source.html b/docs/doxygen/nel/agent__3dvector_8h-source.html new file mode 100644 index 00000000..5ebd341a --- /dev/null +++ b/docs/doxygen/nel/agent__3dvector_8h-source.html @@ -0,0 +1,327 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

agent_3dvector.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX D.T.C. SYSTEM.
+00010  * NEVRAX D.T.C. SYSTEM is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX D.T.C. SYSTEM is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX D.T.C. SYSTEM; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_AGENT_3DVECTOR_H
+00027 #define NL_AGENT_3DVECTOR_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/ai/logic/boolval.h"
+00031 #include "nel/misc/vectord.h"
+00032 
+00033 
+00034 //using NLMISC::CVectorD;
+00035 
+00036 
+00037 namespace NLAIAGENT
+00038 {       
+00047         class IVector: public IObjetOp
+00048         {
+00049         protected:
+00050                 NLMISC::CVectorD _Value;
+00051 
+00052         public:
+00053 
+00055                 IVector(double x, double y, double z):_Value(x, y, z)
+00056                 {
+00057                 }
+00058 
+00059                 IVector(const NLMISC::CVectorD &v):_Value(v)
+00060                 {                       
+00061                 }
+00062 
+00063                 IVector(const IVector &value):IObjetOp(value), _Value((NLMISC::CVectorD)value._Value)
+00064                 {
+00065                 }
+00066                 IVector()
+00067                 {                       
+00068                 }
+00069                 IVector(NLMISC::IStream &is)
+00070                 {
+00071                         load(is);
+00072                 }
+00073 
+00074                 virtual ~IVector()
+00075                 {
+00076                 }
+00077 
+00078                 virtual void save(NLMISC::IStream &os)
+00079                 {       
+00080                         os.serial( _Value );
+00081                 }
+00082 
+00083                 virtual void load(NLMISC::IStream &is)
+00084                 {                               
+00085                         is.serial( _Value );
+00086                 }               
+00087 
+00088                 virtual bool isEqual(const IBasicObjectIA &a) const
+00089                 {                       
+00090                         return !(*(IObjectIA *)this == (IObjetOp &)a);
+00091                 }
+00092 
+00093                 virtual bool isTrue() const
+00094                 {
+00095                         return true;
+00096                 }
+00097 
+00098                 const NLMISC::CVectorD &getValueRef() const
+00099                 {
+00100                         return _Value;
+00101                 }
+00102 
+00103                 NLMISC::CVectorD getValue() const
+00104                 {
+00105                         return _Value;
+00106                 }
+00107 
+00108                 void setValue(NLMISC::CVectorD value) 
+00109                 {
+00110                         _Value = value;
+00111                 }               
+00112 
+00113                 double x() const
+00114                 {
+00115                         return _Value.x;
+00116                 }
+00117 
+00118                 double y() const
+00119                 {
+00120                         return _Value.y;
+00121                 }
+00122 
+00123                 double z() const
+00124                 {
+00125                         return _Value.z;
+00126                 }
+00127 
+00128                 void x(const double u)
+00129                 {
+00130                         _Value.x = u;
+00131                 }
+00132 
+00133                 void y(const double v)
+00134                 {
+00135                         _Value.y = v;
+00136                 }
+00137 
+00138                 void z(const double w)
+00139                 {
+00140                         _Value.z = w;
+00141                 }
+00142 
+00143                 double squareLength()
+00144                 {
+00145                         return _Value.x * _Value.x + _Value.y * _Value.y + _Value.z * _Value.z;
+00146                 }
+00147 
+00148                 double length()
+00149                 {
+00150                         return (double) sqrt(squareLength());
+00151                 }
+00152 
+00153                 void unit()
+00154                 {
+00155                         _Value.normalize();
+00156                 }
+00157 
+00158                 virtual IObjectIA &operator = (const IObjectIA &a)
+00159                 {
+00160                         NLMISC::CVectorD v((NLMISC::CVectorD)((const IVector &)a).getValue());
+00161                         _Value = v;
+00162                         return *this;
+00163                 }
+00164 
+00165                 virtual IObjetOp &operator += (const IObjetOp &a)
+00166                 {
+00167                         NLMISC::CVectorD v = (NLMISC::CVectorD)((const IVector &)a).getValue();
+00168                         _Value += v;
+00169                         return *this;
+00170                 }
+00171 
+00172                 virtual IObjetOp &operator -= (const IObjetOp &a)
+00173                 {
+00174                         NLMISC::CVectorD v = (NLMISC::CVectorD)((const IVector &)a).getValue();
+00175                         _Value -= v;
+00176                         return *this;
+00177                 }
+00178 
+00179                 virtual IObjetOp *operator + (const IObjetOp &a) 
+00180                 {
+00181                         IObjetOp *o = (IObjetOp *)clone();                      
+00182                         *o += a;
+00183                         return o;
+00184                 }
+00185 
+00186                 virtual IObjetOp *operator - (const IObjetOp &a) 
+00187                 {
+00188                         IObjetOp *o = (IObjetOp *)clone();                      
+00189                         *o -= a;
+00190                         return o;
+00191                 }
+00192 
+00193                 virtual IObjetOp *operator != (IObjetOp &a) const
+00194                 {
+00195                         NLMISC::CVectorD v = (NLMISC::CVectorD)((const IVector &)a).getValue();                 
+00196                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value != v);                        
+00197                         return x;
+00198                 }
+00199 
+00200                 virtual IObjetOp *operator == (IObjetOp &a) const
+00201                 {
+00202                         NLMISC::CVectorD v = (NLMISC::CVectorD)((const IVector &)a).getValue();                 
+00203                         NLAILOGIC::CBoolType *x = new NLAILOGIC::CBoolType(_Value == v);                        
+00204                         return x;
+00205                 }
+00206 
+00207                 virtual sint32 getMethodIndexSize() const;
+00208                 virtual tQueue isMember(const IVarName *,const IVarName *,const IObjectIA &) const;
+00209                 virtual CProcessResult runMethodeMember(sint32, sint32, IObjectIA *);
+00210                 virtual CProcessResult runMethodeMember(sint32 index,IObjectIA *);
+00211                 virtual sint32 isClassInheritedFrom(const IVarName &) const;
+00212         };
+00213 
+00223         class VectorType: public IVector
+00224         {
+00225         public:
+00226 
+00227                 static const NLAIC::CIdentType IdVectorType;
+00228 
+00229         public:
+00230                 VectorType(double x, double y, double z):IVector(x, y, z)
+00231                 {                       
+00232                 }
+00233 
+00234                 VectorType(const NLMISC::CVectorD &v):IVector(v)
+00235                 {                       
+00236                 }
+00237 
+00238                 VectorType():IVector()
+00239                 {                       
+00240                 }
+00241 
+00242                 VectorType(const VectorType &a):IVector(a)
+00243                 {                       
+00244                 }
+00245 
+00246                 VectorType(NLMISC::IStream &is):IVector(is)
+00247                 {
+00248                 }
+00249                 
+00250                 virtual const NLAIC::IBasicType *clone() const
+00251                 {
+00252                         NLAIC::IBasicInterface *m = new VectorType(*this);                      
+00253                         return m;
+00254                 }
+00255                 
+00256                 virtual const NLAIC::IBasicType *newInstance() const
+00257                 {
+00258                         return clone();
+00259                 }
+00260 
+00261                 virtual const NLAIC::CIdentType &getType() const;               
+00262                 
+00263 
+00264                 virtual void getDebugString(std::string &text) const
+00265                 {
+00266                         text = NLAIC::stringGetBuild("Vector <%f %f %f>",getValue().x, getValue().y, getValue().z);
+00267                 }               
+00268 
+00269                 virtual const CProcessResult &run();
+00270         };
+00271 }
+00272 
+00273 
+00274 #endif // NL_AGENT_3DVECTOR_H
+00275 
+00276 /* End of agent_3dvector.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1