#include "Object.h"
#include <iostream.h>

// rather dummy constructor, box is not shown at all
Object::Object(){

  //sizes
  box[0] = 0;
  box[1] = 0;
  box[2] = 0;

  // color , rgb
  color[0] = 0;
  color[1] = 0;
  color[2] = 0;
}

Object::Object( GLfloat *Size,
		GLfloat *Pose,
		GLfloat *Frame,
		GLfloat *Color ){

  // object to manipulate 
  // global frame

  for( int k = 0; k < 16; k++ ) Tgo[k] = Frame[k];

  
  // in local frame of the robot(computed only when object attached)
  Tro[0] = Tro[5] = Tro[10] = Tro[15] = 1;
  Tro[1] = Tro[2] = Tro[3] = Tro[4] = 
    Tro[6] = Tro[7] = Tro[8] = Tro[9] = 
    Tro[11] = Tro[12] = Tro[13] = Tro[14] = 0;

  //sizes
  box[0] = Size[0];
  box[1] = Size[1];
  box[2] = Size[2];

  // position( local frame of box,  0 0 0 - in the center )
  box_pos[0] = Pose[0];
  box_pos[1] = Pose[1];
  box_pos[2] = Pose[2];

  // color , rgb
  color[0] = Color[0];
  color[1] = Color[1];
  color[2] = Color[2];

  attached = false;

#ifdef DEBUG
  cerr << "object created " << endl;
  cerr << "colors : " 
       << color[0] << " " 
       << color[1] << " " 
       << color[2] << endl;
  cerr << "sizes : " 
       << box[0] << " " 
       << box[1] << " " 
       << box[2] << endl;
  cerr << "center : " 
       << box_pos[0] << " " 
       << box_pos[1] << " " 
       << box_pos[2] << endl;

  cerr << "frame : " << endl;
  for( int c = 0; c < 16; c++) cerr << Tgo[c] << " "; 
#endif

}


