humberto
04-06-2001, 03:20 PM
Hi OpenGL Community,
I am working ina final project that consists in a 3D Robot Modeller where the user can build his own robots linking pieces of
the robot like we do when we are using lego.
My class robot is a set of component where the component can be
specialiazed in 4 classes: The first rotates the robot piece in one axis, the second rotates in two axis, the third rotates in 3 axis and the last makes translation movements like hands do for example.
When I have to display the robot I have to display the components in the right order using glPushMatrix() and glPopMatrix().
(Current situation of the project)
Ex: (C++)
Component * base = new Component;
CFDegree * arm = new CFDegree; // One level of movement (Z)
CSDegree * forearm = new CSDegree; // Two levels of movement (Z,X)
CTransl * hand = new CTransl; // Hands translates to open and
close
Robot * robot = new Robot;
robot->add_component(base);
robot->add_component(arm);
robot->add_component(forearm);
robot->add_component(hand);
robot->display(); // draws the robot
PS:When its just a robot arm, the robot can be a list of components ..
But Imagine if its any kind of robot with a body, head, n-arms, n-
forearms and n-hands ...
The challenge is what kind of data structure should I have to use for
my robot (Tree of components, Graph of components, list ...) ?
And How can I do to create a robot with its pieces in C++ without
having to declare its components as objects ?
If someone knows something about this in a website, tutorial or
book ... please let me know
thanks in advance
I am working ina final project that consists in a 3D Robot Modeller where the user can build his own robots linking pieces of
the robot like we do when we are using lego.
My class robot is a set of component where the component can be
specialiazed in 4 classes: The first rotates the robot piece in one axis, the second rotates in two axis, the third rotates in 3 axis and the last makes translation movements like hands do for example.
When I have to display the robot I have to display the components in the right order using glPushMatrix() and glPopMatrix().
(Current situation of the project)
Ex: (C++)
Component * base = new Component;
CFDegree * arm = new CFDegree; // One level of movement (Z)
CSDegree * forearm = new CSDegree; // Two levels of movement (Z,X)
CTransl * hand = new CTransl; // Hands translates to open and
close
Robot * robot = new Robot;
robot->add_component(base);
robot->add_component(arm);
robot->add_component(forearm);
robot->add_component(hand);
robot->display(); // draws the robot
PS:When its just a robot arm, the robot can be a list of components ..
But Imagine if its any kind of robot with a body, head, n-arms, n-
forearms and n-hands ...
The challenge is what kind of data structure should I have to use for
my robot (Tree of components, Graph of components, list ...) ?
And How can I do to create a robot with its pieces in C++ without
having to declare its components as objects ?
If someone knows something about this in a website, tutorial or
book ... please let me know
thanks in advance