Source Code

/////////////////////////////////////////////////////////////
//
// Source file for BulletinBoard
//
//    This file is generated by RapidApp 1.2
//
//    This class is derived from BulletinBoardUI which
//    implements the user interface created in
//    RapidApp. This class contains virtual
//    functions that are called from the user interface.
//
//    When you modify this source, limit your changes to
//    modifying the sections between the
//    "//---- Start/End editable code block" markers
//
//    This will allow RapidApp to integrate changes more easily
//
//    This class is a ViewKit user interface "component".
//    For more information on how components are used, see the
//    "ViewKit Programmers' Manual", and the RapidApp
//    User's Guide.
/////////////////////////////////////////////////////////////

#include "BulletinBoard.h"
#include <Vk/VkEZ.h>
#include <GL/GLwMDrawA.h>
#include <Xm/BulletinB.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/PushB.h>
#include <Xm/Scale.h>
#include <Vk/VkResource.h>
#include <Vk/VkSimpleWindow.h>
 

extern void VkUnimplemented ( Widget, const char * );

///////////////////////////////////////////////////////////////////////////////
// The following non-container elements are created by BulletinBoardUI and are
// available as protected data members inherited by this class
//
//  XmLabel      _label19
//  XmPushButton      _button9
//  XmPushButton      _button8
//  XmLabel      _label18
//  XmPushButton      _button7
//  XmPushButton      _button6
//  XmLabel      _label17
//  XmPushButton      _button5
//  XmPushButton      _button4
//  XmLabel      _label16
//  XmLabel      _label15
//  XmPushButton      _button3
//  XmPushButton      _button2
//  XmPushButton      _button1
//  XmPushButton      _button
//  XmLabel      _label14
//  XmLabel      _label13
//  XmLabel      _label12
//  XmLabel      _label11
//  XmLabel      _label10
//  XmLabel      _label9
//  XmLabel      _label8
//  XmLabel      _label7
//  XmLabel      _label6
//  XmLabel      _label5
//  XmLabel      _label4
//  XmScale      _scale1
//  XmScale      _scale9
//  XmScale      _scale8
//  XmScale      _scale7
//  XmScale      _scale6
//  XmScale      _scale5
//  XmScale      _scale4
//  XmScale      _scale3
//  XmScale      _scale2
//  XmScale      _scale
//  XmLabel      _label3
//  XmLabel      _label2
//  XmLabel      _label1
//  XmLabel      _label
//  GLwMDrawingArea      _glwidget
//
///////////////////////////////////////////////////////////////////////////////
 

//---- Start editable code block: headers and declarations
//------------------------------------------------------------------------------
// Declaration
//------------------------------------------------------------------------------
#include <iostream.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <stdio.h>
#include <iostream.h>
#include <Vk/VkPeriodic.h>
#include "XwindowSupport.h"
#include "yeowseng.SlRGB.h"
#include <math.h>
#define XWINDOWSIZE 950
#define YWINDOWSIZE 950
#define PI 3.141593
float theColor[4] = {0.0,  0.0,  0.0,  1.0};
GLsizei w=950.0, h=950.0;
void ToggleAnim();
int Plane_Eq(float Qnodex, float Qnodey, float Qnodez);
//------------------------------------------------------------------------------
// Animation
//------------------------------------------------------------------------------
int size = 30;
int animating = 0;

void Anim(void);

class MyPeriodic : public VkPeriodic{
public:

  MyPeriodic(int interval)
     : VkPeriodic(interval)            // Initialize base class
   {;}

   virtual void tick(void){ Anim(); }
};

MyPeriodic* mp = 0;

//------------------------------------------------------------------------------
// Control Points
//------------------------------------------------------------------------------
float angle_base=0.0, move_link1=0.0, move_link2=0, move_arm_extension=0;
float angle_workspace=0.0;
float Theta1=0.0, Theta2=0.0, Theta3=0.0, Theta4=0.0, Theta5=0.0, Theta6=0.0;
float Theta7=0.0, Theta8=0.0, Theta9=0.0, Theta10=0.0, Theta11=0.0, Theta12=0.0, Theta13=0.0;

//------------------------------------------------------------------------------
// Perspective Projection
//------------------------------------------------------------------------------
float Fovy=60.0, Aspect=1.0;
float  PNear=0.01, PFar=1000.0;

//------------------------------------------------------------------------------
// Camera Controls
//------------------------------------------------------------------------------
float Eyex=80.0, Eyey=-5.0, Eyez=0.0;
float Cenx=0.0, Ceny=-10.0, Cenz=0.0;
float Upx=0.0, Upy=1.0, Upz=0.0;
//float Eyex=45.0, Eyey=-5.0, Eyez=0.0;
//float Cenx=0.0, Ceny=-10.0, Cenz=0.0;
//float Upx=0.0, Upy=1.0, Upz=0.0;
//float Eyex=5.0, Eyey=15.0, Eyez=0.0;
//float Cenx=-10.0, Ceny=-475.0, Cenz=0.0;
//float Upx=0.0, Upy=1.0, Upz=0.0;

//------------------------------------------------------------------------------
// Light Properties
//-----------------------------------------------------------------------------
//light from infinity
 GLfloat light_infinity_ambient[]={0.3,0.3,0.3,1.0};
 GLfloat light_infinity_diffuse[]={0.3,0.3,0.3,1.0};
 GLfloat light_infinity_specular[]={0.5,0.5,0.5,1.0};
 GLfloat light_infinity_emission[]={0.5,0.5,0.5,1.0};
 GLfloat light_infinity_position[]={0.0,110.0,25.0,1.0};

//------------------------------------------------------------------------------
// Material Properties
//------------------------------------------------------------------------------
 GLfloat base_ambient[]={0.2,0.2,0.2,1.0};
 GLfloat base_diffuse[]={0.3,0.3,0.3,1.0};
 GLfloat base_specular[]={0.3,0.3,0.3,1.0};
 GLfloat base_emission[]={0.1,0.1,0.1,1.0};
 
 GLfloat link_ambient[]={0.5,0.5,0.0,1.0};
 GLfloat link_diffuse[]={0.5,0.5,0.0,1.0};
 GLfloat link_specular[]={0.5,0.5,0.0,1.0};
 GLfloat link_emission[]={0.1,0.1,0.1,1.0};

//------------------------------------------------------------------------------
// Others
//------------------------------------------------------------------------------
 GLUquadricObj *qobj;
 GLuint frame=1, base=2, link1=3, link2=4, arm=5;
 GLuint arm_extension=6, end_factor=7;
 GLuint motors=8, workspace=9, joints=10, arm_part2=11;
 GLuint obstacles=12, sphere=13, sphere2=14;

//------------------------------------------------------------------------------
// Control Modes
//------------------------------------------------------------------------------
int View_1=1, View_2=0;
int Anime_Mode=0;
int Animation_Mode=0;
int  ReAnimate=0, Showpath=0, Showtree=0;

//------------------------------------------------------------------------------
// Textures
//------------------------------------------------------------------------------
void floor()
{
 float TexWidth, TexHeight;
 SlRGB myPicture;
 myPicture.LoadFile("yeowseng.floor.rgb");
 TexWidth=myPicture.getWidth();
 TexHeight=myPicture.getHeight();
 glPixelStorei(GL_UNPACK_ALIGNMENT,1);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
 glTexImage2D(GL_TEXTURE_2D,0,4,TexWidth,TexHeight,0,GL_RGB,GL_UNSIGNED_BYTE,myPicture.getData());
 glEnable(GL_TEXTURE_2D);
 glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
}

void obstacle()
{
 float TexWidth, TexHeight;
 SlRGB myPicture;
 myPicture.LoadFile("yeowseng.obstacle.rgb");
 TexWidth=myPicture.getWidth();
 TexHeight=myPicture.getHeight();
 glPixelStorei(GL_UNPACK_ALIGNMENT,1);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
 glTexImage2D(GL_TEXTURE_2D,0,4,TexWidth,TexHeight,0,GL_RGB,GL_UNSIGNED_BYTE,myPicture.getData());
 glEnable(GL_TEXTURE_2D);
 glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
}

void Tiger()
{
 float TexWidth, TexHeight;
 SlRGB myPicture;
 myPicture.LoadFile("yeowseng.tiger.rgb");
 TexWidth=myPicture.getWidth();
 TexHeight=myPicture.getHeight();
 glPixelStorei(GL_UNPACK_ALIGNMENT,1);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
 glTexImage2D(GL_TEXTURE_2D,0,4,TexWidth,TexHeight,0,GL_RGB,GL_UNSIGNED_BYTE,myPicture.getData());
 glEnable(GL_TEXTURE_2D);
 glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_BLEND);
}
//------------------------------------------------------------------------------
// Drawings
//------------------------------------------------------------------------------
 GLfloat colors[][4] =
 {{1.0,0.0,0.0,1.0},{0.0,1.0,0.0,1.0},{0.0,0.0,1.0,1.0},{1.0,1.0,1.0,1.0},{1.0,1.0,0.0,1.0},
 {1.0,0.0,1.0,1.0},{0.0,1.0,1.0,1.0},{0.90,0.90,0.90}};

 GLfloat vertices[][3] =
//square base(0->23)
 {{0.0,0.0,0.0},{20.0,0.0,0.0},{20.0,0.0,20.0},{0.0,0.0,20.0},
 {0.0,5.0,0.0},{20.0,5.0,0.0},{20.0,5.0,20.0},{0.0,5.0,20.0},
 {0.0,0.0,0.0},{0.0,5.0,0.0},{20.0,5.0,0.0},{20.0,0.0,0.0},
 {20.0,0.0,0.0},{20.0,5.0,0.0},{20.0,5.0,20.0},{20.0,0.0,20.0},
 {20.0,0.0,20.0},{20.0,5.0,20.0},{0.0,5.0,20.0},{0.0,0.0,20.0},
 {0.0,0.0,20.0},{0.0,5.0,20.0},{0.0,5.0,0.0},{0.0,0.0,0.0},
//square arm(24->71)
 //octagon
 {1.0,-2.0,0.0},{-1.0,-2.0,0.0},{-2.0,-1.0,0.0},{-2.0,1.0,0.0},
 {-1.0,2.0,0.0},{1.0,2.0,0.0},{2.0,1.0,0.0},{2.0,-1.0,0.0},
 {1.0,-2.0,7.5},{-1.0,-2.0,7.5},{-2.0,-1.0,7.5},{-2.0,1.0,7.5},
 {-1.0,2.0,7.5},{1.0,2.0,7.5},{2.0,1.0,7.5},{2.0,-1.0,7.5},
 //square
 {-1.0,-2.0,0.0},{1.0,-2.0,0.0},{1.0,-2.0,7.5},{-1.0,-2.0,7.5},
 {-2.0,-1.0,0.0},{-1.0,-2.0,0.0},{-1.0,-2.0,7.5},{-2.0,-1.0,7.5},
 {-2.0,1.0,0.0},{-2.0,-1.0,0.0},{-2.0,-1.0,7.5},{-2.0,1.0,7.5},
 {-1.0,2.0,0.0},{-2.0,1.0,0.0},{-2.0,1.0,7.5},{-1.0,2.0,7.5},
 {1.0,2.0,0.0},{-1.0,2.0,0.0},{-1.0,2.0,7.5},{1.0,2.0,7.5},
 {2.0,1.0,0.0},{1.0,2.0,0.0},{1.0,2.0,7.5},{2.0,1.0,7.5},
 {2.0,-1.0,0.0},{2.0,1.0,0.0},{2.0,1.0,7.5},{2.0,-1.0,7.5},
 {1.0,-2.0,0.0},{2.0,-1.0,0.0},{2.0,-1.0,7.5},{1.0,-2.0,7.5}};

 GLfloat normals[][3] =
//square base(0->23)
 {{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},
 {0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},
//square arm(24->71)
 //octagon
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},
 {0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},
 {0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},
 //square
 {-1.0,-2.0,0.0},{1.0,-2.0,0.0},{1.0,-2.0,6.0},{-1.0,-2.0,6.0},
 {-2.0,-1.0,0.0},{-1.0,-2.0,0.0},{-1.0,-2.0,6.0},{-2.0,-1.0,6.0},
 {-2.0,1.0,0.0},{-2.0,-1.0,0.0},{-2.0,-1.0,6.0},{-2.0,1.0,6.0},
 {-1.0,2.0,0.0},{-2.0,1.0,0.0},{-2.0,1.0,6.0},{-1.0,2.0,6.0},
 {1.0,2.0,0.0},{-1.0,2.0,0.0},{-1.0,2.0,6.0},{1.0,2.0,6.0},
 {2.0,1.0,0.0},{1.0,2.0,0.0},{1.0,2.0,6.0},{2.0,1.0,6.0},
 {2.0,-1.0,0.0},{2.0,1.0,0.0},{2.0,1.0,6.0},{2.0,-1.0,6.0},
 {1.0,-2.0,0.0},{2.0,-1.0,0.0},{2.0,-1.0,6.0},{1.0,-2.0,6.0}};

 GLfloat Textures[][2] =
//square base(0->23)
 {{0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0},
//square arm(24->71)
 //octagon
 {1.0,-2.0},{-1.0,-2.0},{-2.0,-1.0},{-2.0,1.0},
 {-1.0,2.0},{1.0,2.0},{2.0,1.0},{2.0,-1.0},
 {1.0,-2.0},{-1.0,-2.0},{-2.0,-1.0},{-2.0,1.0},
 {-1.0,2.0},{1.0,2.0},{2.0,1.0},{2.0,-1.0},
 //square
 {-1.0,-2.0},{1.0,-2.0},{1.0,-2.0},{-1.0,-2.0},
 {-2.0,-1.0},{-1.0,-2.0},{-1.0,-2.0},{-2.0,-1.0},
 {-2.0,1.0},{-2.0,-1.0},{-2.0,-1.0},{-2.0,1.0},
 {-1.0,2.0},{-2.0,1.0},{-2.0,1.0},{-1.0,2.0},
 {1.0,2.0},{-1.0,2.0},{-1.0,2.0},{1.0,2.0},
 {2.0,1.0},{1.0,2.0},{1.0,2.0},{2.0,1.0},
 {2.0,-1.0},{2.0,1.0},{2.0,1.0},{2.0,-1.0},
 {1.0,-2.0},{2.0,-1.0},{2.0,-1.0},{1.0,-2.0}};

void Squares(int a, int b, int c, int d)
{
    glBegin(GL_POLYGON);
        glNormal3fv(normals[a]);
 glTexCoord2fv(Textures[a]);
        glVertex3fv(vertices[a]);
        glNormal3fv(normals[b]);
 glTexCoord2fv(Textures[b]);
        glVertex3fv(vertices[b]);
        glNormal3fv(normals[c]);
 glTexCoord2fv(Textures[c]);
        glVertex3fv(vertices[c]);
        glNormal3fv(normals[d]);
 glTexCoord2fv(Textures[d]);
        glVertex3fv(vertices[d]);
    glEnd();
}

void Octagons(int a, int b, int c, int d, int e, int f, int g, int h)
{
    glBegin(GL_POLYGON);
        glNormal3fv(normals[a]);
 glTexCoord2fv(Textures[a]);
        glVertex3fv(vertices[a]);
        glNormal3fv(normals[b]);
 glTexCoord2fv(Textures[b]);
        glVertex3fv(vertices[b]);
        glNormal3fv(normals[c]);
 glTexCoord2fv(Textures[c]);
        glVertex3fv(vertices[c]);
        glNormal3fv(normals[d]);
 glTexCoord2fv(Textures[d]);
        glVertex3fv(vertices[d]);
 glNormal3fv(normals[e]);
 glTexCoord2fv(Textures[e]);
        glVertex3fv(vertices[e]);
        glNormal3fv(normals[f]);
 glTexCoord2fv(Textures[f]);
        glVertex3fv(vertices[f]);
        glNormal3fv(normals[g]);
 glTexCoord2fv(Textures[g]);
        glVertex3fv(vertices[g]);
        glNormal3fv(normals[h]);
 glTexCoord2fv(Textures[h]);
        glVertex3fv(vertices[h]);
    glEnd();
}
 

//------------------------------------------------------------------------------
// Drawings Obstacles
//------------------------------------------------------------------------------
 GLfloat colors_obs[][4] =
 {{0.3,0.8,0.6,1.0},{0.0,0.0,1.0,1.0}};

 GLfloat vertices_obs[][3] =
 {{-50.0,0.0,50.0},{50.0,0.0,50.0},{50.0,0.0,-50.0},{-50.0,0.0,-50.0},  //top(0-3)
 {-50.0,-50.0,50.0},{50.0,-50.0,50.0},{50.0,-50.0,-50.0},{-50.0,-50.0,-50.0}, //floor(4-7)
 {50.0,-50.0,50.0},{50.0,-50.0,-50.0},{50.0,0.0,-50.0},{50.0,0.0,50.0},  //wall_x(8-11)
 {-50.0,-50.0,50.0},{-50.0,-50.0,-50.0},{-50.0,0.0,-50.0},{-50.0,0.0,50.0}, //wall_-x(12-15)
 {-50.0,-50.0,50.0},{50.0,-50.0,50.0},{50.0,0.0,50.0},{-50.0,0.0,50.0},  //wall_z(16-19)
 {-50.0,-50.0,-50.0},{50.0,-50.0,-50.0},{50.0,0.0,-50.0},{-50.0,0.0,-50.0}, //wall_-z(20-23)
 
 {-40.0,-40.0,30.0},{30.0,-40.0,30.0},{30.0,-40.0,-10.0},{-40.0,-40.0,-10.0}, //obs1_y(24-27)
 {-40.0,-50.0,30.0},{30.0,-50.0,30.0},{30.0,-50.0,-10.0},{-40.0,-50.0,-10.0}, //obs1_-y(28-31)
 {30.0,-50.0,30.0},{30.0,-50.0,-10.0},{30.0,-40.0,-10.0},{30.0,-40.0,30.0}, //obs1_x(32-35)
 {-40.0,-50.0,30.0},{-40.0,-50.0,-10.0},{-40.0,-40.0,-10.0},{-40.0,-40.0,30.0}, //obs1_-x(36-39)
 {-40.0,-50.0,30.0},{30.0,-50.0,30.0},{30.0,-40.0,30.0},{-40.0,-40.0,30.0}, //obs1_z(40-43)
 {-40.0,-50.0,-10.0},{30.0,-50.0,-10.0},{30.0,-40.0,-10.0},{-40.0,-40.0,-10.0}, //obs1_-z(44-47)
 
 {-20.0,-30.0,-25.0},{45.0,-30.0,-25.0},{45.0,-30.0,-40.0},{-20.0,-30.0,-40.0}, //obs2_y(48-51)
 {-20.0,-50.0,-25.0},{45.0,-50.0,-25.0},{45.0,-50.0,-40.0},{-20.0,-50.0,-40.0}, //obs2_-y(52-55)
 {45.0,-50.0,-25.0},{45.0,-50.0,-40.0},{45.0,-30.0,-40.0},{45.0,-30.0,-25.0}, //obs2_x(56-59)
 {-20.0,-50.0,-25.0},{-20.0,-50.0,-40.0},{-20.0,-30.0,-40.0},{-20.0,-30.0,-25.0},//obs2_-x(60-63)
 {-20.0,-50.0,-25.0},{45.0,-50.0,-25.0},{45.0,-30.0,-25.0},{-20.0,-30.0,-25.0}, //obs2_z(64-67)
 {-20.0,-50.0,-40.0},{45.0,-50.0,-40.0},{45.0,-30.0,-40.0},{-20.0,-30.0,-40.0}, //obs2_-z(68-71)
 
 {10.0,-15.0,50.0},{50.0,-15.0,50.0},{50.0,-15.0,30.0},{10.0,-15.0,30.0}, //obs3_y(72-75)
 {10.0,-50.0,50.0},{50.0,-50.0,50.0},{50.0,-50.0,30.0},{10.0,-50.0,30.0}, //obs3_-y(76-79)
 {50.0,-50.0,50.0},{50.0,-50.0,30.0},{50.0,-15.0,30.0},{50.0,-15.0,50.0}, //obs3_x(80-83)
 {10.0,-50.0,50.0},{10.0,-50.0,30.0},{10.0,-15.0,30.0},{10.0,-15.0,50.0}, //obs3_-x(84-87)
 {10.0,-50.0,50.0},{50.0,-50.0,50.0},{50.0,-15.0,50.0},{10.0,-15.0,50.0}, //obs3_z(88-91)
 {10.0,-50.0,30.0},{50.0,-50.0,30.0},{50.0,-15.0,30.0},{10.0,-15.0,30.0}, //obs3_-z(92-95)

 {-45.0,-15.0,-10.0},{-30.0,-15.0,-10.0},{-30.0,-15.0,-35.0},{-45.0,-15.0,-35.0},//obs4_y(96-99)
 {-45.0,-50.0,-10.0},{-30.0,-50.0,-10.0},{-30.0,-50.0,-35.0},{-45.0,-50.0,-35.0},//obs4_-y(100-103)
 {-30.0,-50.0,-10.0},{-30.0,-50.0,-35.0},{-30.0,-15.0,-35.0},{-30.0,-15.0,-10.0},//obs4_x(104-107)
 {-45.0,-50.0,-10.0},{-45.0,-50.0,-35.0},{-45.0,-15.0,-35.0},{-45.0,-15.0,-10.0},//obs4_-x(108-111)
 {-45.0,-50.0,-10.0},{-30.0,-50.0,-10.0},{-30.0,-15.0,-10.0},{-45.0,-15.0,-10.0},//obs4_z(112-115)
 {-45.0,-50.0,-35.0},{-30.0,-50.0,-35.0},{-30.0,-15.0,-35.0},{-45.0,-15.0,-35.0},//obs4_-z(116-119)
 
 {-30.0,-20.0,25.0},{-10.0,-20.0,25.0},{-10.0,-20.0,5.0},{-30.0,-20.0,5.0}, //obs5_y(120-123)
 {-30.0,-40.0,25.0},{-10.0,-40.0,25.0},{-10.0,-40.0,5.0},{-30.0,-40.0,5.0}, //obs5_-y(124-127)
 {-10.0,-40.0,25.0},{-10.0,-40.0,5.0},{-10.0,-20.0,5.0},{-10.0,-20.0,25.0}, //obs5_x(128-131)
 {-30.0,-40.0,25.0},{-30.0,-40.0,5.0},{-30.0,-20.0,5.0},{-30.0,-20.0,25.0}, //obs5_-x(132-135)
 {-30.0,-40.0,25.0},{-10.0,-40.0,25.0},{-10.0,-20.0,25.0},{-30.0,-20.0,25.0}, //obs5_z(136-139)
 {-30.0,-40.0,5.0},{-10.0,-40.0,5.0},{-10.0,-20.0,5.0},{-30.0,-20.0,5.0}, //obs5_-z(140-143)
 
 {-10.0,-35.0,20.0},{10.0,-35.0,20.0},{10.0,-35.0,7.5},{-10.0,-35.0,7.5}, //obs6_y(144-147)
 {-10.0,-40.0,20.0},{10.0,-40.0,20.0},{10.0,-40.0,7.5},{-10.0,-40.0,7.5}, //obs6_-y(148-151)
 {10.0,-40.0,20.0},{10.0,-40.0,7.5},{10.0,-35.0,7.5},{10.0,-35.0,20.0},  //obs6_x(152-155)
 {-10.0,-40.0,20.0},{-10.0,-40.0,7.5},{-10.0,-35.0,7.5},{-10.0,-35.0,20.0}, //obs6_-x(156-159)
 {-10.0,-40.0,20.0},{10.0,-40.0,20.0},{10.0,-35.0,20.0},{-10.0,-35.0,20.0}, //obs6_z(160-163)
 {-10.0,-40.0,7.5},{10.0,-40.0,7.5},{10.0,-35.0,7.5},{-10.0,-35.0,7.5},  //obs6_-z(164-167)
 
 {10.0,-25.0,10.0},{25.0,-25.0,10.0},{25.0,-25.0,-10.0},{10.0,-25.0,-10.0}, //obs7_y(168-171)
 {10.0,-40.0,10.0},{25.0,-40.0,10.0},{25.0,-40.0,-10.0},{10.0,-40.0,-10.0}, //obs7_-y(172-175)
 {25.0,-40.0,10.0},{25.0,-40.0,-10.0},{25.0,-25.0,-10.0},{25.0,-25.0,10.0}, //obs7_x(176-179)
 {10.0,-40.0,10.0},{10.0,-40.0,-10.0},{10.0,-25.0,-10.0},{10.0,-25.0,10.0}, //obs7_-x(180-183)
 {10.0,-40.0,10.0},{25.0,-40.0,10.0},{25.0,-25.0,10.0},{10.0,-25.0,10.0}, //obs7_z(184-187)
 {10.0,-40.0,-10.0},{25.0,-40.0,-10.0},{25.0,-25.0,-10.0},{10.0,-25.0,-10.0}, //obs7_-z(188-191)
 
 {5.0,-45.0,-10.0},{25.0,-45.0,-10.0},{25.0,-45.0,-25.0},{5.0,-45.0,-25.0}, //obs8_y(192-195)
 {5.0,-50.0,-10.0},{25.0,-50.0,-10.0},{25.0,-50.0,-25.0},{5.0,-50.0,-25.0}, //obs8_-y(196-199)
 {25.0,-50.0,-10.0},{25.0,-50.0,-25.0},{25.0,-45.0,-25.0},{25.0,-45.0,-10.0}, //obs8_x(200-203)
 {5.0,-50.0,-10.0},{5.0,-50.0,-25.0},{5.0,-45.0,-25.0},{5.0,-45.0,-10.0}, //obs8_-x(204-207)
 {5.0,-50.0,-10.0},{25.0,-50.0,-10.0},{25.0,-45.0,-10.0},{5.0,-45.0,-10.0}, //obs8_z(208-211)
 {5.0,-50.0,-25.0},{25.0,-50.0,-25.0},{25.0,-45.0,-25.0},{5.0,-45.0,-25.0}, //obs8_-z(212-215)

 {-30.0,-38.0,-10.0},{-5.0,-38.0,-10.0},{-5.0,-38.0,-25.0},{-30.0,-38.0,-25.0}, //obs9_y(216-219)
 {-30.0,-50.0,-10.0},{-5.0,-50.0,-10.0},{-5.0,-50.0,-25.0},{-30.0,-50.0,-25.0}, //obs9_-y(220-223)
 {-5.0,-50.0,-10.0},{-5.0,-50.0,-25.0},{-5.0,-38.0,-25.0},{-5.0,-38.0,-10.0}, //obs9_x(224-227)
 {-30.0,-50.0,-10.0},{-30.0,-50.0,-25.0},{-30.0,-38.0,-25.0},{-30.0,-38.0,-10.0},//obs9_-x(228-231)
 {-30.0,-50.0,-10.0},{-5.0,-50.0,-10.0},{-5.0,-38.0,-10.0},{-30.0,-38.0,-10.0}, //obs9_z(232-235)
 {-30.0,-50.0,-25.0},{-5.0,-50.0,-25.0},{-5.0,-38.0,-25.0},{-30.0,-38.0,-25.0}}; //obs9_-z(236-239)

 GLfloat normals_obs[][3] =
 {{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //top
 {0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0},{0.0,-1.0,0.0}, //floor
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //wall_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //wall_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //wall_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //wall_-z
 

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs1_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs1_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs1_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs1_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs1_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs1_-z
 
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs2_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs2_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs2_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs2_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs2_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs2_-z
 
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs3_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs3_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs3_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs3_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs3_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs3_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs4_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs4_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs4_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs4_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs4_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs4_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs5_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs5_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs5_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs5_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs5_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs5_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs6_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs6_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs6_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs6_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs6_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs6_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs7_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs7_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs7_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs7_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs7_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs7_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs8_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs8_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs8_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs8_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs8_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}, //obs8_-z

 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs9_y
 {0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0},{0.0,1.0,0.0}, //obs9_-y
 {1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0},{1.0,0.0,0.0}, //obs9_x
 {-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0},{-1.0,0.0,0.0}, //obs9_-x
 {0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0},{0.0,0.0,1.0}, //obs9_z
 {0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0},{0.0,0.0,-1.0}}; //obs9_-z

 GLfloat Textures_obs[][2] =
 {{0.0,0.0},{0.0,25.0},{25.0,25.0},{25.0,0.0}, //top
 {0.0,0.0},{0.0,25.0},{25.0,25.0},{25.0,0.0}, //floor
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //wall_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //wall_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //wall_-z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //wall_-x

 {0.0,0.0},{0.0,7.0},{4.0,7.0},{4.0,0.0}, //obs1_y
 {0.0,0.0},{0.0,7.0},{4.0,7.0},{4.0,0.0}, //obs1_-y
 {0.0,0.0},{0.0,4.0},{4.0,1.0},{1.0,0.0}, //obs1_x
 {0.0,0.0},{0.0,4.0},{1.0,4.0},{1.0,0.0}, //obs1_-x
 {0.0,0.0},{0.0,7.0},{1.0,7.0},{1.0,0.0}, //obs1_z
 {0.0,0.0},{0.0,7.0},{1.0,7.0},{1.0,0.0}, //obs1_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs3_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs3_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs3_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs3_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs3_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs4_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs4_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs4_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs4_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs4_-z
 
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs5_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs5_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs5_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs5_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs5_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs6_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs6_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs6_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs6_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs6_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs7_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs7_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs7_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs7_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs7_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs8_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs8_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs8_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs8_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs8_-z

 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs9_y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs2_-y
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs9_x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs9_-x
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}, //obs9_z
 {0.0,0.0},{0.0,1.0},{1.0,1.0},{1.0,0.0}}; //obs9_-z
 

void Squares_obs(int a, int b, int c, int d)
{
    glBegin(GL_POLYGON);
        glNormal3fv(normals_obs[a]);
 glTexCoord2fv(Textures_obs[a]);
        glVertex3fv(vertices_obs[a]);
        glNormal3fv(normals_obs[b]);
 glTexCoord2fv(Textures_obs[b]);
        glVertex3fv(vertices_obs[b]);
        glNormal3fv(normals_obs[c]);
 glTexCoord2fv(Textures_obs[c]);
        glVertex3fv(vertices_obs[c]);
        glNormal3fv(normals_obs[d]);
 glTexCoord2fv(Textures_obs[d]);
        glVertex3fv(vertices_obs[d]);
    glEnd();
}
 

//------------------------------------------------------------------------------
// Graphics Output
//------------------------------------------------------------------------------
void Drawings()
{
 glPushMatrix();//For Joint 1
 glTranslatef(0.0,2.0,0.0); //1st variable
//Base
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glCallList(base);
 glPopMatrix();
//Joints
 glPushMatrix();//For Joint 1
 glRotatef(angle_base,0.0,1.0,0.0); //theta1
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(joints);
 glPopMatrix();
//Link1
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-5.0,-2.0);
 glCallList(link1);
 glPopMatrix();
//Motor1
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-5.0,-2.0);
 glCallList(motors);
 glPopMatrix();
//Joints
 glPushMatrix();
 glTranslatef(0.0,0.0,move_link1); //for translate1 (z axis variable2)
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-7.5,0.0);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(joints);
 glPopMatrix();
//Link2
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(-20.0,-12.5,0.0);
 glRotatef(90.0,0.0,1.0,0.0);
 glCallList(link2);
 glPopMatrix();
//Motor2
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(2.5,-12.5,0.0);
 glRotatef(180.0,0.0,0.0,1.0);
 glRotatef(90.0,0.0,1.0,0.0);
 glCallList(motors);
 glPopMatrix();
//Joints
 glPushMatrix();
 glTranslatef(-move_link2,0.0,0.0); //for translate2 (x axis variable3)
// glTranslatef(0,0.0,0.0); //for translate2 (x axis variable3)
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-15.5,0.0);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(joints);
 glPopMatrix();
//Arm
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-18,0.0);
 glCallList(arm);
 glPopMatrix();
//Arm Part 2
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-24.5,0.0);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(arm_part2);
 glPopMatrix();
//Arm Extension
 glPushMatrix();
 glTranslatef(0.0,move_arm_extension,0.0); //for translate3 (y axis variable3)
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-24.5,0.0);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(arm_extension);
 glPopMatrix();
//End Factor
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(0.0,-24.5,0.0);
 glRotatef(90.0,1.0,0.0,0.0);
 glCallList(end_factor);
 glPopMatrix();

 glPopMatrix(); //for joint 1
 glPopMatrix(); //for translate 1
 glPopMatrix(); //for translate 2
 glPopMatrix(); //for translate 3
 glPopMatrix(); //for translate Up

//Workspace
 glPushMatrix();
 glTranslatef(0.0,-50.0,0.0);
 glRotatef(0.0,0.0,1.0,0.0);
 glTranslatef(0.0,50.0,0.0);
 glDisable(GL_TEXTURE_2D);
 floor();
 glTranslatef(0.0,-50.0,0.0);
 glCallList(workspace);
 glPopMatrix();
 
//Obstacles
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 obstacle();
 glCallList(obstacles);
 glPopMatrix();
 

//Sphere
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(46.0,-47.5,0.25);
 glCallList(sphere);
 glPopMatrix();

//Sphere2
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 glTranslatef(-15.0,-47.5,42.0);
 glCallList(sphere);
 glPopMatrix();

}

void Drawings2()
{
//Workspace
 glPushMatrix();
 glTranslatef(0.0,-50.0,0.0);
// glRotatef(Upx*180,0.0,1.0,0.0);
 glRotatef(0.0,0.0,1.0,0.0);
 glTranslatef(0.0,50.0,0.0);
 glPushMatrix();
 glDisable(GL_TEXTURE_2D);
 floor();
 glTranslatef(0.0,-50.0,0.0);
 glCallList(workspace);
 glPopMatrix();
}

//------------------------------------------------------------------------------
// RRT
//------------------------------------------------------------------------------
#define Null 0
#define Reached 1
#define Search 2
struct Nodes{
 float x, y, z, proj;
 float angle;
 int parent;
 int Node_Number;
};
struct Distance{
 float x, y, z;
 float alpha, beta, gamma, proj;
};
struct GoalDistance{
 float x, y, z;
};
Nodes node[10000];
Nodes path[1000];
Nodes temp_node[10000];
Nodes current_node;
Distance dist[10000];
Distance current_dist;
int Num_of_Node=1;
int parent=0, level=0;
int Dparent[10000];
int NN=0, NewNN=0;
int path1done=0, path_num=0;
float d1=-7.5, d3=-14.0;
float a1=0.0, a2=0.0, d4=0.0, theta1=0.0;
float qx=0.0, qy=0.0, qz=0.0;
float goal[3];
float metric=5, Min_Distance=0;
//------------------------------------------------------------------------------
// Collision Detection
//------------------------------------------------------------------------------
int pass0=1, pass1=0, pass2=0, pass3=0, pass4=0, pass5=0;
int pass6=0, pass7=0, pass8=0, pass9=0, total_pass=0;
int Collision=0, A=0;
//---- End editable code block: headers and declarations
 
 

//------------------------------------------------------------------------------
// Part 1(Collision Detection)
//------------------------------------------------------------------------------

int Plane_Eq(float Qnodex,float Qnodey,float Qnodez){
//------------------------------------------------------------------------------
// Data_Acquisition
//------------------------------------------------------------------------------

 int ObsNum=10;
 int PlNum=6;
 int  LnNum=4;
 int Init_PtNum=0;
 int counter=0;

 float x[10][6][4],y[10][6][4],z[10][6][4];

 for(int i=0; i<ObsNum; i++){
  for(int j=0; j<PlNum; j++){
   for(int k=0; k<LnNum; k++){
    x[i][j][k]=vertices_obs[Init_PtNum][0];
    y[i][j][k]=vertices_obs[Init_PtNum][1];
    z[i][j][k]=vertices_obs[Init_PtNum][2];
    Init_PtNum++;
   }
  }
 }

/* cout << "begin" << endl;
 for(i=0; i<ObsNum; i++){
  for(int j=0; j<PlNum; j++){
   for(int k=0; k<LnNum; k++){
    cout << "counter[" << counter << "]" << endl;
    cout << "vertices_x[" << x[i][j][k] << "]" << endl;
    cout << "vertices_y[" << y[i][j][k] << "]" << endl;
    cout << "vertices_z[" << z[i][j][k] << "]" << endl;
    counter++;
   }
  }
 }
*/

//------------------------------------------------------------------------------
// Vectors Declarations and Calculations
//------------------------------------------------------------------------------

 float a[10][6],b[10][6],c[10][6],d[10][6];
 float ti[10][6], DD[10][6];
 float pointx=0.0,pointy=0.0,pointz=0.0;
 pointx=Qnodex;
 pointy=Qnodey;
 pointz=Qnodez;
 
 cout<<"pointx["<<pointx<<"]"<<"pointy["<<pointy<<"]"<<"pointz["<<pointz<<"]"<<endl;

 for(i=0; i<ObsNum; i++){
  for(int j=0; j<PlNum; j++){
 a[i][j]=((y[i][j][1]-y[i][j][0])*(z[i][j][2]-z[i][j][0]))-((z[i][j][1]-z[i][j][0])*(y[i][j][2]-y[i][j][0]));
 b[i][j]=((z[i][j][1]-z[i][j][0])*(x[i][j][2]-x[i][j][0]))-((x[i][j][1]-x[i][j][0])*(z[i][j][2]-z[i][j][0]));
 c[i][j]=((x[i][j][1]-x[i][j][0])*(y[i][j][2]-y[i][j][0]))-((y[i][j][1]-y[i][j][0])*(x[i][j][2]-x[i][j][0]));
 d[i][j]=-(a[i][j]*x[i][j][0]+b[i][j]*y[i][j][0]+c[i][j]*z[i][j][0]);
 ti[i][j]=-(a[i][j]*pointx+b[i][j]*pointy+c[i][j]*pointz+d[i][j])/(a[i][j]*a[i][j]+b[i][j]*b[i][j]+c[i][j]*c[i][j]);
 DD[i][j]=ti[i][j]*sqrt(a[i][j]*a[i][j]+b[i][j]*b[i][j]+c[i][j]*c[i][j]);
  }
 }

 cout << "equation" << endl;
 pass0=1, pass1=0, pass2=0, pass3=0, pass4=0, pass5=0;
 pass6=0, pass7=0, pass8=0, pass9=0, total_pass=0;

 for(i=0; i<ObsNum; i++){
//  cout << "ObsNum[" << i << "]" << endl;
  for(int j=0; j<PlNum; j++){
//    cout << "PlNum[" << j << "]" << endl;
//    cout << "a[ObsNum][PlNum][" << a[i][j] << "]" << endl;
//    cout << "b[ObsNum][PlNum][" << b[i][j] << "]" << endl;
//    cout << "c[ObsNum][PlNum][" << c[i][j] << "]" << endl;
//    cout << "d[ObsNum][PlNum][" << d[i][j] << "]" << endl;
//    cout << "ti[ObsNum][PlNum][" << ti[i][j] << "]" << endl;
//    cout << "DD[ObsNum][PlNum][" << DD[i][j] << "]" << endl;
  }
 }

 if((-2<DD[0][0])&&(2>DD[0][1])&&(-2<DD[0][2])&&(2>DD[0][3])&&(-2<DD[0][4])&&(2>DD[0][5])){
  pass0=0;
 }
 if((-2<DD[1][0])&&(2>DD[1][1])&&(-2<DD[1][2])&&(2>DD[1][3])&&(-2<DD[1][4])&&(2>DD[1][5])){
  pass1=1;
 }
 if((-2<DD[2][0])&&(2>DD[2][1])&&(-2<DD[2][2])&&(2>DD[2][3])&&(-2<DD[2][4])&&(2>DD[2][5])){
  pass2=1;
 }
 if((-2<DD[3][0])&&(2>DD[3][1])&&(-2<DD[3][2])&&(2>DD[3][3])&&(-2<DD[3][4])&&(2>DD[3][5])){
  pass3=1;
 }
 if((-2<DD[4][0])&&(2>DD[4][1])&&(-2<DD[4][2])&&(2>DD[4][3])&&(-2<DD[4][4])&&(2>DD[4][5])){
  pass4=1;
 }
 if((-2<DD[5][0])&&(2>DD[5][1])&&(-2<DD[5][2])&&(2>DD[5][3])&&(-2<DD[5][4])&&(2>DD[5][5])){
  pass5=1;
 }
 if((-2<DD[6][0])&&(2>DD[6][1])&&(-2<DD[6][2])&&(2>DD[6][3])&&(-2<DD[6][4])&&(2>DD[6][5])){
  pass6=1;
 }
 if((-2<DD[7][0])&&(2>DD[7][1])&&(-2<DD[7][2])&&(2>DD[7][3])&&(-2<DD[7][4])&&(2>DD[7][5])){
  pass7=1;
 }
 if((-2<DD[8][0])&&(2>DD[8][1])&&(-2<DD[8][2])&&(2>DD[8][3])&&(-2<DD[8][4])&&(2>DD[8][5])){
  pass8=1;
 }
 if((-2<DD[9][0])&&(2>DD[9][1])&&(-2<DD[9][2])&&(2>DD[9][3])&&(-2<DD[9][4])&&(2>DD[9][5])){
  pass9=1;
 }
 
/* cout<<"pass0["<<pass0<<"]"<<"pass1["<<pass1<<"]"<< "pass2["<<pass2<<"]"<<
 "pass3["<<pass3<<"]"<<"pass4["<<pass4<<"]"<<endl;
 cout<<"pass5["<<pass5<<"]"<<"pass6["<<pass6<<"]"<< "pass7["<<pass7<<"]"<<
 "pass8["<<pass8<<"]"<<"pass9["<<pass9<<"]"<<endl;
*/ total_pass=pass0+pass1+pass2+pass3+pass4+pass5+pass6+pass7+pass8+pass9;
 
 if(total_pass==0){
  Collision=0;
 } else Collision=1;

 cout << "Collision0[" << Collision << "]" << endl;

 return(Collision);
 

}
 

void RRT(){
//------------------------------------------------------------------------------
// Part 2 (Motion Strategy)
//------------------------------------------------------------------------------
 
 

// Collision=0;

GoalDistance gdist[10000];
float Dist[10000], gDist[10000], temp_Dist=0.0, node_Dist=0;
float current_Dist=0;
float Shortest=0.0, Shortest_to_goal=0.0;

int TNN=0, TNum_of_Node=1, Tparent=0, Tlevel=1;
 
Num_of_Node=1;

int State=Search;
int selected=0, gselected=0;
int Iteration=1;
node[0].x=46.0, node[0].y=-40.0, node[0].z=1.0;
node[0].Node_Number=0, node[0].parent=Null;
node[0].angle=0;
goal[0]=-15.0, goal[1]=-40.0, goal[2]=42.0;

int path_number=0, num_of_path=0;

//--------------------------------------------------------------------
//  Build RRT
//--------------------------------------------------------------------
for(int j=0; j<Iteration; j++){
 //-------------------------------------------------------------
 //  Possible Random Combinations
 //-------------------------------------------------------------
 a1=52.5*(rand()%1000)/1000;
 a2=22.5*(rand()%1000)/1000;
 d4=-19.5*(rand()%1000)/1000;
 theta1=360*PI/180*(rand()%1000)/1000;
 
 qx=a2*sin(theta1)+(a1*cos(theta1));
 qz=-a2*cos(theta1)+(a1*sin(theta1));
 qy=d3+d4+d1;
 cout << "qx["<<qx<<"]"<<"qy["<<qy<<"]"<<"qz["<<qz<<"]"<<endl;

if (State==Search){
 for(int i=0; i<Num_of_Node; i++){
 
 dist[i].x=qx-node[i].x;
 dist[i].y=qy-node[i].y;
 dist[i].z=qz-node[i].z;
 Dist[i]=sqrt((dist[i].x)*(dist[i].x)+(dist[i].y)*(dist[i].y)+(dist[i].z)*(dist[i].z));
 }

 //-------------------------------------------------------------
 //  check for the nearest nodes
 //-------------------------------------------------------------
 for(i=0; i<Num_of_Node; i++){
 Shortest=Dist[0];
  if (Num_of_Node>1&&Dist[i]<Dist[0]){
   Dist[0]=Dist[i];
   selected=i;
   parent=i;
  }
 Shortest=Dist[0];
 }
// cout<<"Shortest["<<Shortest<<"]"<<"selected["<<selected<<"]"<<endl;
 cout<<"selected["<<selected<<"]"<<"parent["<<parent<<"]"<<"level["<<level<<"]"<<endl;
 //-------------------------------------------------------------
 //  Get the info of current node
 //-------------------------------------------------------------
 current_node.x=node[selected].x;
 current_node.y=node[selected].y;
 current_node.z=node[selected].z;
 current_node.Node_Number=node[selected].Node_Number;
 current_node.parent=node[selected].parent;
 
/* cout<<"current_node.x["<<current_node.x<<"]"<<"current_node.y["<<current_node.y<<"]"
  <<"current_node.z["<<current_node.z<<"]"<<endl;
*/
 current_dist.x=qx-current_node.x;
 current_dist.y=qy-current_node.y;
 current_dist.z=qz-current_node.z;
 current_Dist=sqrt((current_dist.x)*(current_dist.x)+(current_dist.y)*(current_dist.y)
   +(current_dist.z)*(current_dist.z));
 current_dist.gamma=asin(current_dist.y/current_Dist);
 current_dist.proj=current_Dist*cos(current_dist.gamma);
 current_dist.alpha=asin(current_dist.z/current_dist.proj);
 current_dist.beta=asin(current_dist.x/current_dist.proj);
 
/* cout<<"current_dist.x["<<current_dist.x<<"]"<<"current_dist.y["<<current_dist.y<<"]"<<
  "current_dist.z["<<current_dist.z<<"]"<<"current_Dist["<<current_Dist<<"]"<<endl;       cout<<"current_dist.proj["<<current_dist.proj<<"]"<<
  "current_dist.alpha["<<(current_dist.alpha)<<"]"<<
  "current_dist.beta["<<(current_dist.beta)<<"]"<<
  "current_dist.gamma["<<(current_dist.gamma)<<"]"<<endl;
*/
 //-------------------------------------------------------------
 //  Extend from the current node
 //-------------------------------------------------------------

 TNN++;
 temp_node[TNN].y=metric*sin(current_dist.gamma)+current_node.y;
 temp_node[TNN].x=temp_node[TNN].proj*sin(current_dist.beta)+current_node.x;
 temp_node[TNN].z=temp_node[TNN].proj*sin(current_dist.alpha)+current_node.z;
 temp_Dist=sqrt((temp_node[TNN].x)*(temp_node[TNN].x)+(temp_node[TNN].y)*
   (temp_node[TNN].y)+(temp_node[TNN].z)*(temp_node[TNN].z));
 temp_node[TNN].Node_Number=TNN;
 temp_node[TNN].parent=selected;

 cout<<"current_Dist["<<current_Dist<<"]"<<endl;

 //-------------------------------------------------------------
 //  Check for collision
 //-------------------------------------------------------------
 //if no collision the continue
 //if collide then skip

 Collision=Plane_Eq(temp_node[TNN].x,temp_node[TNN].y,temp_node[TNN].z);
 cout<<"Collision["<<Collision<<"]"<<endl;

 if(Collision==0){
 
 NN++;
 Num_of_Node++;

 node[NN].proj=temp_node[TNN].proj;
 node[NN].y=temp_node[TNN].y;
 node[NN].x=temp_node[TNN].x;
 node[NN].z=temp_node[TNN].z;
 node_Dist=sqrt((node[NN].x)*(node[NN].x)+(node[NN].y)*(node[NN].y)+
   (node[NN].z)*(node[NN].z));
 node[NN].Node_Number=temp_node[TNN].Node_Number;
 node[NN].parent=temp_node[TNN].parent;

 }

 if(Collision==1) {
 TNN=TNN-1;
 }

/* cout<<"node[NN].x["<<node[NN].x<<"]"<<"node[NN].y["<<node[NN].y<<"]"
  <<"node[NN].z["<<node[NN].z<<"]"<<"node_Dist["<<node_Dist<<"]"<<endl;
 
 cout<<"node[NN].Node_Number["<<node[i].Node_Number<<"]"<<
 "node[NN].parent["<<node[i].parent<<"]"<<endl;
*/

 //-------------------------------------------------------------
 //  Check if the State==Reached
 //-------------------------------------------------------------
 //check for distance from goal to nearest node

 for(i=0; i<Num_of_Node; i++){
 gdist[i].x=goal[0]-node[i].x;
 gdist[i].y=goal[1]-node[i].y;
 gdist[i].z=goal[2]-node[i].z;
 gDist[i]=sqrt((gdist[i].x)*(gdist[i].x)+(gdist[i].y)*(gdist[i].y)+(gdist[i].z)*(gdist[i].z));
/* cout << "begin4" << endl;
 cout << "gdist[i].x[" << gdist[i].x << "]" << endl;
 cout << "gdist[i].y[" << gdist[i].y << "]" << endl;
 cout << "gdist[i].z[" << gdist[i].z << "]" << endl;
 cout << "gDist[i][" << gDist[i] << "]" << endl;
*/ }
 
 //-------------------------------------------------------------
 //  check for the nearest nodes to goal
 //-------------------------------------------------------------
 for(i=0; i<Num_of_Node; i++){
 Shortest_to_goal=gDist[0];
  if ((Num_of_Node)>1&&gDist[i]<gDist[0]){
   gDist[0]=gDist[i];
   gselected=i;
  }
 Shortest_to_goal=gDist[0];
 }
/* cout << "Shortest_to_goal[" << Shortest_to_goal << "]" << endl;
 cout << "Num_of_Node[" << Num_of_Node << "]" << endl;
*/ cout << "NN[" << NN << "]" << endl;

 
 if(Shortest_to_goal>5){
  Iteration++;
 }
 if(Shortest_to_goal<=5){
  //----------------------------------------------
  //  Path nodes
  //----------------------------------------------
  NewNN=NN;
  int k=NewNN;
  while(NewNN>0){
   path[path_num].x=node[k].x;
   path[path_num].y=node[k].y;
   path[path_num].z=node[k].z;
   path[path_num].Node_Number=node[k].Node_Number;
   path[path_num].parent=node[k].parent;
   path[path_num].angle=atan(path[path_num].x/path[path_num].z);
   path_num++;
   k=node[k].parent;
   if(k==0){
    path[path_num].x=node[0].x;
    path[path_num].y=node[0].y;
    path[path_num].z=node[0].z;
    path[path_num].Node_Number=node[0].Node_Number;
    path[path_num].parent=node[0].parent;
   // path[path_num].angle=node[0].angle;
    NewNN=0;
    }
  }
  A=path_num;
  State=Reached;
  i=Iteration;
 }
 cout << "Num_of_Node[" << Num_of_Node << "]" << endl;
 cout << "path_num[" << path_num << "]" << endl;

}//close for if state !=0
}//close for Iteration
}//close for function RRT

void InitCondition(){
 angle_base=0;
 move_link1=0;
 move_link2=0;
 move_arm_extension=0;
}

void NewCondition()
{

if(Anime_Mode==1){
 angle_base=path[A].angle*180/PI;
// angle_base=0;
 move_link1=path[A].z;
 move_link2=0.4*path[A].x;
// move_link2=0;
// move_link1=0;
 move_arm_extension=path[A].y;
// move_arm_extension=0;
 cout << "begin"<< endl;
 cout << "Node_Number[" << path[A].Node_Number << "]" <<"angle_base["<<angle_base<<"]"<<
 "x["<<move_link2<<"]"<<"y["<<move_arm_extension<<"]"<<"z["<<move_link1<<"]"<< endl;
 A--;

}

if(ReAnimate==1){
 A=path_num;
}
}

void DrawNewLoc()
{
 if(Anime_Mode==0){
  InitCondition();
 }

 if(Anime_Mode==1){
  NewCondition();
 }

}

void Anim(){
     glClearColor(theColor[0],  theColor[1],  theColor[2],  theColor[3]);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 glEnable(GL_LIGHTING);
 glEnable(GL_LIGHT0);
 glEnable(GL_DEPTH_TEST);
 glEnable(GL_NORMALIZE);
 glShadeModel(GL_SMOOTH);

 if(View_1==1){
 Drawings();
 }

 if(View_2==1){
 Drawings2();
 }

 DrawNewLoc();
     GLSwapBuffers();

}
 
 
 
 

//---- BulletinBoard Constructor

BulletinBoard::BulletinBoard(const char *name, Widget parent) :
                   BulletinBoardUI(name, parent)
{
    // This constructor calls BulletinBoardUI(parent, name)
    // which calls BulletinBoardUI::create() to create
    // the widgets for this component. Any code added here
    // is called after the component's interface has been built

    //---- Start editable code block: BulletinBoard constructor
 

    //---- End editable code block: BulletinBoard constructor
 
 

}    // End Constructor
 
 

BulletinBoard::BulletinBoard(const char *name) :
                   BulletinBoardUI(name)
 {
    // This constructor calls BulletinBoardUI(name)
    // which does not create any widgets. Usually, this
    // constructor is not used

    //---- Start editable code block: BulletinBoard constructor 2
 

    //---- End editable code block: BulletinBoard constructor 2
 
 

}    // End Constructor
 
 

BulletinBoard::~BulletinBoard()
{
    // The base class destructors are responsible for
    // destroying all widgets and objects used in this component.
    // Only additional items created directly in this class
    // need to be freed here.

    //---- Start editable code block: BulletinBoard destructor
 

    //---- End editable code block: BulletinBoard destructor
 
 

}    // End Destructor
 

const char * BulletinBoard::className() // classname
{
    return ("BulletinBoard");
} // End className()
 

void BulletinBoard::CM_Animation_Off ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Animation_Off

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Animation_Off is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_Animation_Off" );

 Anime_Mode=0;
 ToggleAnim();
 Draw_Scene(w,  callData);

    //---- End editable code block: BulletinBoard CM_Animation_Off

}    // End BulletinBoard::CM_Animation_Off()

void BulletinBoard::CM_Animation_On ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Animation_On

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Animation_On is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_Animation_On" );

 ToggleAnim();
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard CM_Animation_On

}    // End BulletinBoard::CM_Animation_On()
 

void BulletinBoard::CM_Anime ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Anime

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Anime is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_Anime" );

 Anime_Mode=1;
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard CM_Anime

}    // End BulletinBoard::CM_Anime()
 

void BulletinBoard::CM_Path ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Path

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Path is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_Path" );

 Showtree=0;
 Showpath=1;
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard CM_Path

}    // End BulletinBoard::CM_Path()
 

void BulletinBoard::CM_RRT ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_RRT

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_RRT is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_RRT" );

 Showpath=0;
 Showtree=1;
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard CM_RRT

}    // End BulletinBoard::CM_RRT()
 

void BulletinBoard::CM_ReAnimate_Off ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_ReAnimate_Off

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_ReAnimate_Off is implemented:

//   ::VkUnimplemented ( w, "BulletinBoard::CM_ReAnimate_Off" );

 ReAnimate=0;
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard CM_ReAnimate_Off

}    // End BulletinBoard::CM_ReAnimate_Off()
 

void BulletinBoard::CM_ReAnimate_On ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_ReAnimate_On

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_ReAnimate_On is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_ReAnimate_On" );

 ReAnimate=1;
 Draw_Scene(w,  callData);
 
 

    //---- End editable code block: BulletinBoard CM_ReAnimate_On

}    // End BulletinBoard::CM_ReAnimate_On()
 

void BulletinBoard::CM_Special_Effect_Off ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Special_Effect_Off

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Special_Effect_Off is implemented:

    ::VkUnimplemented ( w, "BulletinBoard::CM_Special_Effect_Off" );
 
 
 

    //---- End editable code block: BulletinBoard CM_Special_Effect_Off

}    // End BulletinBoard::CM_Special_Effect_Off()
 

void BulletinBoard::CM_Special_Effect_On ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Special_Effect_On

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Special_Effect_On is implemented:

    ::VkUnimplemented ( w, "BulletinBoard::CM_Special_Effect_On" );
 
 
 

    //---- End editable code block: BulletinBoard CM_Special_Effect_On

}    // End BulletinBoard::CM_Special_Effect_On()
 

void BulletinBoard::CM_Viewing ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard CM_Viewing

    XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::CM_Viewing is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::CM_Viewing" );

 Showpath=0;
 Showtree=0;
 Draw_Scene(w,  callData);

    //---- End editable code block: BulletinBoard CM_Viewing

}    // End BulletinBoard::CM_Viewing()
 

void BulletinBoard::Draw_Scene ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard Draw_Scene

    GLwDrawingAreaCallbackStruct *cbs = (GLwDrawingAreaCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::Draw_Scene is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::Draw_Scene" );
 makeGLCurrent();
 glClearColor(theColor[0],  theColor[1],  theColor[2],  theColor[3]);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();

//------------------------------------------------------------------------------
// Viewing mode=(0) Drawing mode=(1)
//------------------------------------------------------------------------------
 gluPerspective(120.0,1.0, PNear, PFar);
 glViewport(0.0, 0.0, 950.0, 950.0);
 glMatrixMode(GL_MODELVIEW);
 glLoadIdentity();
 gluLookAt(Eyex,Eyey,Eyez,Cenx,Ceny,Cenz,0.0,1.0,0.0);
//------------------------------------------------------------------------------
// Lighting
//------------------------------------------------------------------------------
 glPushMatrix();
 glLoadIdentity();
 glLightfv(GL_LIGHT0,GL_POSITION,light_infinity_position);
 glPopMatrix();
 glLightfv(GL_LIGHT0,GL_AMBIENT,light_infinity_ambient);
 glLightfv(GL_LIGHT0,GL_DIFFUSE,light_infinity_diffuse);
 glLightfv(GL_LIGHT0,GL_SPECULAR,light_infinity_specular);
 glLightfv(GL_LIGHT0,GL_EMISSION,light_infinity_emission);

 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_infinity_ambient);
 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

 glEnable(GL_LIGHTING);
 glEnable(GL_LIGHT0);
 glEnable(GL_DEPTH_TEST);
 glEnable(GL_NORMALIZE);
 glShadeModel(GL_SMOOTH);

 if(View_1==1){
 Drawings();
 }

 if(View_2==1){
 Drawings2();
 }
 

//------------------------------------
// RRT (GRAPHICS)
//------------------------------------
 glDisable(GL_LIGHTING);
 glDisable(GL_LIGHT0);
 glPointSize(2.0);

 glPushMatrix();
 if(Showtree==1){
 glPushMatrix();
 glColor3f(0.0,1.0,0.0);
 glBegin(GL_POINTS);
  glVertex3f(node[0].x,node[0].y,node[0].z);
 glEnd();
 glColor3f(1.0,0.0,0.0);
 for(int k=0; k<Num_of_Node; k++){
 glBegin(GL_POINTS);
  glVertex3f(node[k].x,node[k].y,node[k].z);
 glEnd();
 }
 glPopMatrix();
 glColor3f(0.0,1.0,0.0);
 for (k=NN; k>0; k--){
  Dparent[k]=node[k].parent;
   glBegin(GL_LINES);
    glVertex3f(node[k].x,node[k].y,node[k].z);
    glVertex3f(node[Dparent[k]].x,node[Dparent[k]].y,node[Dparent[k]].z);
   glEnd();
 }
 }

 if(Showpath==1){
 glPushMatrix();
 glColor3f(0.0,1.0,0.0);
 glBegin(GL_POINTS);
  glVertex3f(node[0].x,node[0].y,node[0].z);
 glEnd();
 glColor3f(1.0,0.0,0.0);
 for(int k=0; k<Num_of_Node; k++){
 glBegin(GL_POINTS);
  glVertex3f(node[k].x,node[k].y,node[k].z);
 glEnd();
 }
 glPopMatrix();
 glColor3f(1.0,0.0,1.0);
 for (k=0; k<path_num; k++){
  glBegin(GL_LINES);
   glVertex3f(path[k].x,path[k].y,path[k].z);
   glVertex3f(path[k+1].x,path[k+1].y,path[k+1].z);
  glEnd();
 }
 }
 glPopMatrix();
 DrawNewLoc();
 
 GLSwapBuffers();

    //---- End editable code block: BulletinBoard Draw_Scene

}    // End BulletinBoard::Draw_Scene()
 

void ToggleAnim(){
  if(animating)
    mp->stop();
  else
    mp->start();
 
  animating = !animating;
}
void BulletinBoard::Init_Scene ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard Init_Scene

    GLwDrawingAreaCallbackStruct *cbs = (GLwDrawingAreaCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::Init_Scene is implemented:

//   ::VkUnimplemented ( w, "BulletinBoard::Init_Scene" );

 initGLWindow(w, callData);
 makeGLCurrent();
 mp = new MyPeriodic (10);
 glClearColor(theColor[0],  theColor[1],  theColor[2],  theColor[3]);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

 glEnable(GL_LIGHTING);
 glEnable(GL_LIGHT0);
 glEnable(GL_DEPTH_TEST);
 glEnable(GL_NORMALIZE);
 glShadeModel(GL_SMOOTH);
 
 qobj=gluNewQuadric();
 gluQuadricDrawStyle(qobj, GLU_FILL);
 gluQuadricTexture(qobj, GL_TRUE);
//------------------------------------
// Frame
//------------------------------------
 glNewList(frame, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[0]);
 gluSphere(qobj,6.5,10.0,10.0);
 glTranslatef(6.0,2.0,2.5);
 glColor4fv(colors[1]);
 gluSphere(qobj,1.0,10.0,10.0);
 glTranslatef(0.0,0.0,-5.0);
 gluSphere(qobj,1.0,10.0,10.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Base
//------------------------------------
 glNewList(base, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, base_ambient);
 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, base_diffuse);
 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, base_emission);
 glColor4fv(colors[7]);
 glTranslatef(-10.0,0.0,-10.0);
 Squares(0,1,2,3);
 Squares(4,5,6,7);
 Squares(8,9,10,11);
 Squares(12,13,14,15);
 Squares(16,17,18,19);
 Squares(20,21,22,23);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Link1 (done)
//------------------------------------
 glNewList(link1, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 glScalef(1.0,0.5,1.0);
 gluCylinder(qobj,6.0,6.0,52.5,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,6.0,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,52.5);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,6.0,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Link2
//------------------------------------
 glNewList(link2, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 glScalef(1.0,0.5,1.0);
 gluCylinder(qobj,6.0,6.0,22.5,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,6.0,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,22.5);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,6.0,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Arm
//------------------------------------
 glNewList(arm, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 glRotatef(90.0,1.0,0.0,0.0);
 gluCylinder(qobj,4.0,4.0,6.5,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,4.0,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,6.5);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,4.0,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Arm Part 2
//------------------------------------
 glNewList(arm_part2, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 Octagons(24,25,26,27,28,29,30,31);
 Squares(40,41,42,43);
 Squares(44,45,46,47);
 Squares(48,49,50,51);
 Squares(52,53,54,55);
 Squares(56,57,58,59);
 Squares(60,61,62,63);
 Squares(64,65,66,67);
 Squares(68,69,70,71);
 Octagons(32,33,34,35,36,37,38,39);
 glEndList();
//------------------------------------
// Arm Extension
//------------------------------------
 glNewList(arm_extension, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 gluCylinder(qobj,1.0,1.0,15.0,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,1.0,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,15.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,1.0,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// End Factor
//------------------------------------
 glNewList(end_factor, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 gluCylinder(qobj,2.25,2.25,4.5,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,2.25,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,4.5);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,2.25,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Motors
//------------------------------------
 glNewList(motors, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[2]);
 glRotatef(180.0,0.0,1.0,0.0);
 gluCylinder(qobj,2.0,2.0,2.75,12.0,12.0);
 glTranslatef(0.0,0.0,2.75);
 gluCylinder(qobj,3.25,3.25,8.0,12.0,12.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,3.25,12.0,12.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,8.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,3.25,12.0,12.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Workspace
//------------------------------------
 glNewList(workspace, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4f(1.0,1.0,1.0,1.0);
 Squares_obs(0,1,2,3);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Joints
//------------------------------------
 glNewList(joints, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4fv(colors[7]);
 gluCylinder(qobj,2.5,2.5,4.0,10.0,10.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,2.5,10.0,10.0);
 glScalef(1.0,1.0,10.0);
 glTranslatef(0.0,0.0,4.0);
 glScalef(1.0,1.0,0.1);
 gluSphere(qobj,2.5,10.0,10.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Obstacles
//------------------------------------
 glNewList(obstacles, GL_COMPILE);
 glDisable(GL_COLOR_MATERIAL);
 glColor4f(1.0,1.0,1.0,1.0);
 Squares_obs(24,25,26,27);
 Squares_obs(32,33,34,35);
 Squares_obs(36,37,38,39);
 Squares_obs(40,41,42,43);
 Squares_obs(44,45,46,47);
 Squares_obs(48,49,50,51);
 Squares_obs(56,57,58,59);
 Squares_obs(60,61,62,63);
 Squares_obs(64,65,66,67);
 Squares_obs(68,69,70,71);
 Squares_obs(72,73,74,75);
 Squares_obs(80,81,82,83);
 Squares_obs(84,85,86,87);
 Squares_obs(88,89,90,91);
 Squares_obs(92,93,94,95);
 Squares_obs(96,97,98,99);
 Squares_obs(104,105,106,107);
 Squares_obs(108,109,110,111);
 Squares_obs(112,113,114,115);
 Squares_obs(116,117,118,119);
 Squares_obs(120,121,122,123);
 Squares_obs(128,129,130,131);
 Squares_obs(132,133,134,135);
 Squares_obs(136,137,138,139);
 Squares_obs(140,141,142,143);
 Squares_obs(144,145,146,147);
 Squares_obs(152,153,154,155);
 Squares_obs(156,157,158,159);
 Squares_obs(160,161,162,163);
 Squares_obs(164,165,166,167);
 Squares_obs(168,169,170,171);
 Squares_obs(176,177,178,179);
 Squares_obs(180,181,182,183);
 Squares_obs(184,185,186,187);
 Squares_obs(188,189,190,191);
 Squares_obs(192,193,194,195);
 Squares_obs(200,201,202,203);
 Squares_obs(204,205,206,207);
 Squares_obs(208,209,210,211);
 Squares_obs(212,213,214,215);
 Squares_obs(216,217,218,219);
 Squares_obs(224,225,226,227);
 Squares_obs(228,229,230,231);
 Squares_obs(232,233,234,235);
 Squares_obs(236,237,238,239);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Sphere
//------------------------------------
 glNewList(sphere, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4f(0.0,0.5,1.0,1.0);
 gluSphere(qobj,2.5,10.0,10.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();
//------------------------------------
// Sphere2
//------------------------------------
 glNewList(sphere2, GL_COMPILE);
 glEnable(GL_COLOR_MATERIAL);
 glDisable(GL_LIGHTING);
 glDisable(GL_LIGHT0);
 glMaterialfv(GL_FRONT, GL_AMBIENT, link_ambient);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, link_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR, link_specular);
 glColor4f(1.0,0.0,0.0,1.0);
 gluSphere(qobj,2.5,10.0,10.0);
 glDisable(GL_COLOR_MATERIAL);
 glEndList();

 RRT();
 
 
 

    //---- End editable code block: BulletinBoard Init_Scene

}    // End BulletinBoard::Init_Scene()
 

void BulletinBoard::Interact_Scene ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard Interact_Scene

    GLwDrawingAreaCallbackStruct *cbs = (GLwDrawingAreaCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::Interact_Scene is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::Interact_Scene" );
 
 
 

    //---- End editable code block: BulletinBoard Interact_Scene

}    // End BulletinBoard::Interact_Scene()
 

void BulletinBoard::VM_Centerx ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Centerx

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Centerx is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Centerx" );

 Cenx= EZ(_scale3);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Centerx

}    // End BulletinBoard::VM_Centerx()

void BulletinBoard::VM_Centery ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Centery

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Centery is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Centery" );

 Ceny= EZ(_scale4);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Centery

}    // End BulletinBoard::VM_Centery()
 

void BulletinBoard::VM_Centerz ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Centerz

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Centerz is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Centerz" );

 Cenz= EZ(_scale5);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Centerz

}    // End BulletinBoard::VM_Centerz()
 

void BulletinBoard::VM_Eyex ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Eyex

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Eyex is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Eyex" );

 Eyex= EZ(_scale);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Eyex

}    // End BulletinBoard::VM_Eyex()
 

void BulletinBoard::VM_Eyey ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Eyey

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Eyey is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Eyey" );

 Eyey= EZ(_scale1);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Eyey

}    // End BulletinBoard::VM_Eyey()
 

void BulletinBoard::VM_Eyez ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Eyez

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Eyez is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Eyez" );

 Eyez= EZ(_scale2);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Eyez

}    // End BulletinBoard::VM_Eyez()
 

void BulletinBoard::VM_Fovy ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Fovy

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Fovy is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Fovy" );

 Fovy= EZ(_scale9);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Fovy

}    // End BulletinBoard::VM_Fovy()
 

void BulletinBoard::VM_Upx ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Upx

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Upx is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Upx" );

 Upx= EZ(_scale6);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Upx

}    // End BulletinBoard::VM_Upx()
 

void BulletinBoard::VM_Upy ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Upy

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Upy is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Upy" );

 Upy= EZ(_scale7);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Upy

}    // End BulletinBoard::VM_Upy()
 

void BulletinBoard::VM_Upz ( Widget w, XtPointer callData )
{
    //---- Start editable code block: BulletinBoard VM_Upz

    XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;

    //--- Comment out the following line when BulletinBoard::VM_Upz is implemented:

//    ::VkUnimplemented ( w, "BulletinBoard::VM_Upz" );

 Upz= EZ(_scale8);
 Draw_Scene(w,  callData);
 

    //---- End editable code block: BulletinBoard VM_Upz

}    // End BulletinBoard::VM_Upz()
 
 
 
 

///////////////////////////////////////////////////////////////////
// static creation function, for importing class into rapidapp
// or dynamically loading, using VkComponent::loadComponent
///////////////////////////////////////////////////////////////////
 

VkComponent *BulletinBoard::CreateBulletinBoard( const char *name, Widget parent )
{
    VkComponent *obj =  new BulletinBoard ( name, parent );
    return ( obj );
} // End CreateBulletinBoard
 

///////////////////////////////////////////////////////////////////
// Function for accessing a description of the dynamic interface
// to this class.
///////////////////////////////////////////////////////////////////
 

// WARNING: This structure is different than that used with 1.1 RapidApp.
// See the RapidApp release notes for details

struct InterfaceMap {
  char  *resourceName;
  char  *methodName;
  char  *argType;
  char  *definingClass; // Optional, if not this class
  void (VkCallbackObject::*method)(...); // Reserved, do not set
};
 

void *BulletinBoard::RegisterBulletinBoardInterface()
{
    // This structure registers information about this class
    // that allows RapidApp to create and manipulate an instance.
    // Each entry provides a resource name that will appear in the
    // resource manager palette when an instance of this class is
    // selected, the name of the member function as a string,
    // the type of the single argument to this function, and an.
    // optional argument indicating the class that defines this function.
    // All member functions must have the form
    //
    //     void memberFunction ( Type );
    //
    // where "Type" is one of:
    //    const char *    (Use XmRString)
    //    Boolean         (Use XmRBoolean)
    //    int             (Use XmRInt)
    //    float           (Use XmRFloat)
    //    No argument     (Use VkRNoArg or "NoArg"
    //    A filename      (Use VkRFilename or "Filename")
    //    An enumeration  (Use "Enumeration:ClassName:Type: VALUE1, VALUE2, VALUE3")
    //    A callback      (Use XmRCallback)
 

    static InterfaceMap map[] = {
    //---- Start editable code block: BulletinBoardUI resource table

      // { "resourceName", "setAttribute", XmRString},
    //---- End editable code block: BulletinBoardUI resource table
      { NULL }, // MUST be NULL terminated
    };

    return map;
} // End RegisterBulletinBoardInterface()
 
 
 
 
 

//---- End of generated code

//---- Start editable code block: End of generated code
 

//---- End editable code block: End of generated code