<commit_before>#include <string>
#include "robotDynamicsJRLJapan/Joint.h"
#include "robotDynamicsJRLJapan/HumanoidDynamicMultiBody.h"
#include "robotDynamics/jrlRobotDynamicsObjectConstructor.h"
#include <GL/glut.h>

using namespace std;
using namespace dynamicsJRLJapan;

#define TRUE  1
#define FALSE 0

/* Dimensions of texture image. */
#define IMAGE_WIDTH  64
#define IMAGE_HEIGHT 64

/* Step to be taken for each rotation. */
#define ANGLE_STEP 10

//GLdouble view_h = 270, view_v = 0, head_angle = 0;
GLdouble view_h = 0, view_v = 0, head_angle = 0;

DynamicMultiBody * aDMB=0;
HumanoidDynamicMultiBody *aHDMB=0;

GLshort shaded = TRUE, anim = FALSE;
GLshort texture = FALSE, transparent = FALSE;
GLshort light1 = TRUE, light2 = FALSE;


GLubyte image[IMAGE_WIDTH][IMAGE_HEIGHT][3];

/* Variable used in the creaton of glu objects */
GLUquadricObj *obj;

/************ GLUT PART ****************/

/* Makes a simple check pattern image. (Copied from the redbook example
   "checker.c".) */
void
make_image(void)
{
  int i, j, c;

  for (i = 0; i < IMAGE_WIDTH; i++) {
    for (j = 0; j < IMAGE_HEIGHT; j++) {
      c = ((((i & 0x8) == 0) ^ ((j & 0x8)) == 0)) * 255;
      image[i][j][0] = (GLubyte) c;
      image[i][j][1] = (GLubyte) c;
      image[i][j][2] = (GLubyte) c;
    }
  }
}

/* Called when the model's window has been reshaped.  */
void 
myReshape(int w, int h)
{
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 1.0, 20.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -5.0);  /* viewing transform  */
  glScalef(4.0, 4.0, 4.0);
  //  glScalef(1.0, 1.0, 1.0);
}

/* ARGSUSED1 */
void
special(int key, int x, int y)
{
  switch (key) {
  case GLUT_KEY_LEFT:
    if ((view_h -= ANGLE_STEP) <= 0)
      view_h = 360;
    break;
  case GLUT_KEY_RIGHT:
    if ((view_h += ANGLE_STEP) >= 360)
      view_h = 0;
    break;
  case GLUT_KEY_UP:
    if ((view_v += ANGLE_STEP) >= 360)
      view_v = 0;
    break;
  case GLUT_KEY_DOWN:
    if ((view_v -= ANGLE_STEP) <= 0)
      view_v = 360;
    break;
  default:
    return;
  }
  glutPostRedisplay();
}


void DrawRecursiveJoint(CjrlJoint *aJoint)
{
  if (aJoint==0)
    return;
  
  Joint * a2Joint = dynamic_cast<Joint *>( aJoint);
  if (a2Joint==0)
    return;
  
  DynamicBody * aDB = (DynamicBody *)a2Joint->linkedBody();

  int NbChildren = aJoint->countChildJoints();

  
  for(int i=0;i<NbChildren;i++)
    {
      DynamicBody * lDB = (DynamicBody *)(aJoint->childJoint(i).linkedBody());
      glColor4f(1.0, 0.5, 0.9/(a2Joint->rankInConfiguration()+1), 1.0);

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)+0.05, aDB->p(2));
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)+0.05, aDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(lDB->p(0)+0.05,lDB->p(1)-0.05, lDB->p(2));
      glVertex3f(lDB->p(0)-0.05,lDB->p(1)-0.05, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)+0.05, aDB->p(2));
      glVertex3f(lDB->p(0)+0.05,lDB->p(1)+0.05, lDB->p(2));
      glVertex3f(lDB->p(0)+0.05,lDB->p(1)-0.05, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)+0.05,aDB->p(1)+0.05, aDB->p(2));
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)+0.05, aDB->p(2));
      glVertex3f(lDB->p(0)-0.05,lDB->p(1)+0.05, lDB->p(2));
      glVertex3f(lDB->p(0)+0.05,lDB->p(1)+0.05, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)+0.05, aDB->p(2));
      glVertex3f(aDB->p(0)-0.05,aDB->p(1)-0.05, aDB->p(2));
      glVertex3f(lDB->p(0)-0.05,lDB->p(1)-0.05, lDB->p(2));
      glVertex3f(lDB->p(0)-0.05,lDB->p(1)+0.05, lDB->p(2));
      glEnd();

      
    }
  
  for(int i=0;i<NbChildren;i++)<commit_msg>OS: Update the test program<commit_after>#include <string>
#include "robotDynamicsJRLJapan/Joint.h"
#include "robotDynamicsJRLJapan/HumanoidDynamicMultiBody.h"
#include "robotDynamics/jrlRobotDynamicsObjectConstructor.h"
#include <GL/glut.h>

using namespace std;
using namespace dynamicsJRLJapan;

#define TRUE  1
#define FALSE 0

/* Dimensions of texture image. */
#define IMAGE_WIDTH  64
#define IMAGE_HEIGHT 64

/* Step to be taken for each rotation. */
#define ANGLE_STEP 10

//GLdouble view_h = 270, view_v = 0, head_angle = 0;
GLdouble view_h = 230, view_v = 270, head_angle = 0;

DynamicMultiBody * aDMB=0;
HumanoidDynamicMultiBody *aHDMB=0;

GLshort shaded = TRUE, anim = FALSE;
GLshort texture = FALSE, transparent = FALSE;
GLshort light1 = TRUE, light2 = FALSE;


GLubyte image[IMAGE_WIDTH][IMAGE_HEIGHT][3];

/* Variable used in the creaton of glu objects */
GLUquadricObj *obj;

/************ GLUT PART ****************/

/* Makes a simple check pattern image. (Copied from the redbook example
   "checker.c".) */
void
make_image(void)
{
  int i, j, c;

  for (i = 0; i < IMAGE_WIDTH; i++) {
    for (j = 0; j < IMAGE_HEIGHT; j++) {
      c = ((((i & 0x8) == 0) ^ ((j & 0x8)) == 0)) * 255;
      image[i][j][0] = (GLubyte) c;
      image[i][j][1] = (GLubyte) c;
      image[i][j][2] = (GLubyte) c;
    }
  }
}

/* Called when the model's window has been reshaped.  */
void 
myReshape(int w, int h)
{
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 1.0, 20.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -5.0);  /* viewing transform  */
  glScalef(4.0, 4.0, 4.0);
  //  glScalef(1.0, 1.0, 1.0);
}

/* ARGSUSED1 */
void
special(int key, int x, int y)
{
  switch (key) {
  case GLUT_KEY_LEFT:
    if ((view_h -= ANGLE_STEP) <= 0)
      view_h = 360;
    break;
  case GLUT_KEY_RIGHT:
    if ((view_h += ANGLE_STEP) >= 360)
      view_h = 0;
    break;
  case GLUT_KEY_UP:
    if ((view_v += ANGLE_STEP) >= 360)
      view_v = 0;
    break;
  case GLUT_KEY_DOWN:
    if ((view_v -= ANGLE_STEP) <= 0)
      view_v = 360;
    break;
  default:
    return;
  }
  cout << "view_h : " << view_h << " view_v: " << view_v << endl;
  glutPostRedisplay();
}


void DrawRecursiveJoint(CjrlJoint *aJoint)
{
  if (aJoint==0)
    return;
  
  Joint * a2Joint = dynamic_cast<Joint *>( aJoint);
  if (a2Joint==0)
    return;
  
  DynamicBody * aDB = (DynamicBody *)a2Joint->linkedBody();

  int NbChildren = aJoint->countChildJoints();

  
  for(int i=0;i<NbChildren;i++)
    {
      DynamicBody * lDB = (DynamicBody *)(aJoint->childJoint(i).linkedBody());
      glColor4f(1.0, 0.5, 0.9/(a2Joint->rankInConfiguration()+1), 1.0);

      double Ray=0.01;

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)+Ray, aDB->p(2));
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)+Ray, aDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(lDB->p(0)+Ray,lDB->p(1)-Ray, lDB->p(2));
      glVertex3f(lDB->p(0)-Ray,lDB->p(1)-Ray, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)+Ray, aDB->p(2));
      glVertex3f(lDB->p(0)+Ray,lDB->p(1)+Ray, lDB->p(2));
      glVertex3f(lDB->p(0)+Ray,lDB->p(1)-Ray, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)+Ray,aDB->p(1)+Ray, aDB->p(2));
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)+Ray, aDB->p(2));
      glVertex3f(lDB->p(0)-Ray,lDB->p(1)+Ray, lDB->p(2));
      glVertex3f(lDB->p(0)+Ray,lDB->p(1)+Ray, lDB->p(2));
      glEnd();

      glBegin(GL_QUADS);
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)+Ray, aDB->p(2));
      glVertex3f(aDB->p(0)-Ray,aDB->p(1)-Ray, aDB->p(2));
      glVertex3f(lDB->p(0)-Ray,lDB->p(1)-Ray, lDB->p(2));
      glVertex3f(lDB->p(0)-Ray,lDB->p(1)+Ray, lDB->p(2));
      glEnd();
      
    }
  
  for(int i=0;i<NbChildren;i++)
{'fraction_non_alphanumeric': 0.21237761392481566, 'fraction_numerical': 0.05838269068052702, 'mean_word_length': 3.2715539494062984, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 141, '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': '6950900', 'n_tokens_mistral': 3980, 'n_tokens_neox': 3722, 'n_words': 623}