00001 // ---------------------------------------------------------------------------- 00002 // 00003 // tagGame - Example code from the book: 00004 // 00005 // Artficial Intelligence for Computer Games: An Introduction 00006 // by John David Funge 00007 // 00008 // www.ai4games.org 00009 // 00010 // Source code distributed under the Copyright (c) 2003-2007, John David Funge 00011 // Original author: John David Funge (www.jfunge.com) 00012 // 00013 // Licensed under the Academic Free License version 3.0 00014 // (for details see LICENSE.txt in this directory). 00015 // 00016 // ---------------------------------------------------------------------------- 00017 00018 #ifndef TG_UTIL2D_H 00019 #define TG_UTIL2D_H 00020 00021 #include "Matrix.h" 00022 00023 namespace tagGame 00024 { 00026 class Util2D 00027 { 00028 public: 00029 static const size_t dim = 2; 00030 00031 // TODO: inline some of these 00033 static RealMatrix perpendicularTo(RealVec const& v); 00035 static RealVec perpendicularTo(RealVec const& v, RealVec const& d); 00036 static RealVec dir(Real const t); 00037 static RealVec uniformDir(); 00038 static RealVec normalDir(Real const mean, Real const std); 00039 static Real angle(RealVec const& v); 00040 static RealMatrix rotationMatrix(Real const t); 00041 static RealVec randomPosition(RealVec const& worldDim); 00044 static RealMatrix tagentLinePts(RealVec const& p, RealVec const& center, Real const radius); 00047 static RealMatrix perpendicularLinePts(RealVec const& p, RealVec const& center, Real const radius); 00048 }; 00049 } 00050 00051 #endif
1.5.1