Home
FAQ
Player
Utilities
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

RoadGeom.hh

Go to the documentation of this file.
00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: Road geometry
00022  * Author: Andrew Howard
00023  * Date: 22 Oct 2004
00024  * CVS: $Id: RoadGeom.hh,v 1.7 2004/11/01 01:50:24 inspectorg Exp $
00025  */
00026 
00027 #ifndef ROADGEOM_HH
00028 #define ROADGEOM_HH
00029 
00030 #include "Geom.hh"
00031 
00032 
00033 class RoadGeom : public Geom
00034 {
00036   public: RoadGeom(Body *body, dSpaceID spaceId);
00037   
00039   public: virtual ~RoadGeom();
00040 
00042   public: void SetTrackSpacing(double spacing) {this->trackScale = spacing;}
00043 
00045   public: void SetProfileSpacing(double spacing) {this->profileScale = spacing;}
00046 
00050   public: int AddTrackPoint(GzVector pos);
00051 
00055   public: void AddProfilePoint(int index, double pz);
00056 
00060   public: void AddSign(GzVector pos, const char *text);
00061 
00063   private: void InitMesh();
00064 
00066   public: void UpdateMesh(GzVector pos);
00067 
00069   private: void UpdateNormals();
00070 
00072   private: GzVector SplineCR(double t, GzVector p0, GzVector p1,
00073                              GzVector p2, GzVector p3);
00074 
00076   private: GzVector SplineCRtan(double t, GzVector p0, GzVector p1,
00077                                 GzVector p2, GzVector p3);
00078 
00080   public: virtual void Render(RenderOptions *opt);
00081 
00083   private: void RenderSigns(RenderOptions *opt, RenderOptions listOpt);
00084 
00086   private: dTriMeshDataID tridata;
00087 
00089   private: dGeomID trimesh;
00090 
00092   private: int stepsX, stepsY;
00093 
00095   private: double scale;
00096 
00098   private: struct TrackPoint
00099   {
00100     // Position
00101     GzVector pos;
00102     
00104     int profilePointCount, profilePointMaxCount;
00105     GzVector *profilePoints;
00106   };
00107   
00109   private: double trackScale, profileScale;
00110   private: int trackPointCount, trackPointMaxCount;
00111   private: TrackPoint *trackPoints;
00112 
00114   private: struct SignData
00115   {
00117     GzVector pos;
00118 
00120     char *text;
00121   };
00122 
00124   private: int signCount, signMaxCount;
00125   private: SignData *signs;
00126 
00128   private: int vertexCount, vertexMaxCount;
00129   private: dVector3 *vertices;
00130   private: GzVector *normals;
00131 
00133   private: int indexCount, indexMaxCount;
00134   private: int *indices;
00135 
00138   private: double patchSize;
00139 };
00140 
00141 #endif


Last updated $Date: 2004/12/21 01:49:15 $
Generated on Sun May 22 18:39:08 2005 for Gazebo by doxygen 1.4.2