<commit_before>#include <map>
#include <list>

#include <lcm/lcm.h>

#include <bot_core/bot_core.h>
#include <bot_vis/bot_vis.h>

#include <boost/shared_ptr.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>

#include "URDFRigidBodyManipulator.h"
#include "lcmtypes/drake.h"
#include "drake_urdf_renderer.h"

#define UNUSED(x) (void)(x);

using namespace std;

class Geometry {
public:
  virtual ~Geometry(void) {};
  virtual void draw(void) = 0;
};

class Sphere : public Geometry {
public:
  Sphere(float r) : radius(r) {};

  double radius;
  virtual void draw(void) {
    glutSolidSphere(radius,36,36);
  }
};

class Box : public Geometry {
public:
  Box(float x, float y, float z) : dim_x(x), dim_y(y), dim_z(z) {};

  float dim_x, dim_y, dim_z;

  virtual void draw(void) {
    glScalef(dim_x,dim_y,dim_z);
    // glutSolidCube(1.0);
    bot_gl_draw_cube();
  }
};

class Cylinder : public Geometry {
public:
  Cylinder(float r, float l) : radius(r), length(l) {};

  double radius, length;

  virtual void draw(void) {
    // transform to center of cylinder
    glTranslatef(0.0,0.0,-length/2.0);
    
    GLUquadricObj* quadric = gluNewQuadric();
    gluQuadricDrawStyle(quadric, GLU_FILL);
    gluQuadricNormals(quadric, GLU_SMOOTH);
    gluQuadricOrientation(quadric, GLU_OUTSIDE);
    gluCylinder(quadric,
		radius,
		radius,
		length,
		36,
		1);
    gluDeleteQuadric(quadric);
  }

};

class Mesh : public Geometry {
public:
  Mesh(string fname, float scale=1.0) {
    scale_x = scale_y = scale_z = scale;

    boost::filesystem::path mypath(fname);
    string ext = mypath.extension().native();
    boost::to_lower(ext);
	      
    if (ext.compare(".obj")==0) {
      // cout << "Loading mesh from " << fname << " (scale = " << scale << ")" << endl;
      pmesh = bot_wavefront_model_create(fname.c_str());<commit_msg>resolves #97 - cylinders have no end faces in drake viewer<commit_after>#include <map>
#include <list>

#include <lcm/lcm.h>

#include <bot_core/bot_core.h>
#include <bot_vis/bot_vis.h>

#include <boost/shared_ptr.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>

#include "URDFRigidBodyManipulator.h"
#include "lcmtypes/drake.h"
#include "drake_urdf_renderer.h"

#define UNUSED(x) (void)(x);

using namespace std;

class Geometry {
public:
  virtual ~Geometry(void) {};
  virtual void draw(void) = 0;
};

class Sphere : public Geometry {
public:
  Sphere(float r) : radius(r) {};

  double radius;
  virtual void draw(void) {
    glutSolidSphere(radius,36,36);
  }
};

class Box : public Geometry {
public:
  Box(float x, float y, float z) : dim_x(x), dim_y(y), dim_z(z) {};

  float dim_x, dim_y, dim_z;

  virtual void draw(void) {
    glScalef(dim_x,dim_y,dim_z);
    // glutSolidCube(1.0);
    bot_gl_draw_cube();
  }
};

class Cylinder : public Geometry {
public:
  Cylinder(float r, float l) : radius(r), length(l) {};

  double radius, length;

  virtual void draw(void) {
    GLUquadricObj* quadric = gluNewQuadric();
    gluQuadricDrawStyle(quadric, GLU_FILL);
    gluQuadricNormals(quadric, GLU_SMOOTH);
    gluQuadricOrientation(quadric, GLU_OUTSIDE);

    // transform from center of cylinder
    glTranslatef(0.0,0.0,-length/2.0);
    
    // first end cap
    gluDisk(quadric, 0.0, radius, 24, 1);

    // draw the cylinder
    gluCylinder(quadric,
		radius,
		radius,
		length,
		36,
		1);
    
    // second end cap
    glTranslatef(0.0,0.0,length);
    gluDisk(quadric, 0.0, radius, 24, 1);
    
    gluDeleteQuadric(quadric);
  }

};

class Mesh : public Geometry {
public:
  Mesh(string fname, float scale=1.0) {
    scale_x = scale_y = scale_z = scale;

    boost::filesystem::path mypath(fname);
    string ext = mypath.extension().native();
    boost::to_lower(ext);
	      
    if (ext.compare(".obj")==0) {
      // cout << "Loading mesh from " << fname << " (scale = " << scale << ")" << endl;
      pmesh = bot_wavefront_model_create(fname.c_str());
{'fraction_non_alphanumeric': 0.14874596473801838, 'fraction_numerical': 0.013409485969704494, 'mean_word_length': 3.7556080283353013, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4660677', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1542, 'n_words': 322}