class Manipulator : public Map {
static const int sqsize = 16;
+
Polygon *_touching_polygon, *_current_polygon;
scalar_t _grab_relative_x, _grab_relative_y;
scalar_t _xmax, _ymax;
scalar_t _force_x, _force_y;
bool _grab, _release;
int _current_action;
+
enum { FEEL_TOUCHING_OBJECT, FEEL_GRABBING_OBJECT, NB_DISCRETE_PARAMETERS };
+
enum { MAP_LOCATION_X, MAP_LOCATION_Y, MAP_RESISTANCE_X, MAP_RESISTANCE_Y, NB_CONTINUOUS_MAPS };
+
static const int continuous_map_size = 25;
+
scalar_t _kernel_continuous_maps[continuous_map_size * 2 + 1];
+
public:
- enum { ACTION_IDLE,
- ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT,
- ACTION_GRAB, ACTION_RELEASE,
- NB_ACTIONS };
+
+ enum {
+ ACTION_IDLE,
+ ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT,
+ ACTION_GRAB, ACTION_RELEASE,
+ NB_ACTIONS
+ };
+
Manipulator(Task *task);
inline scalar_t hand_x() { return _hand_x; }
else if(degree == 1) _square_size = 150;
else if(degree == 2) _square_size = 100;
else _square_size = 50;
- scalar_t x[] = { -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0, -_square_size / 2.0 };
- scalar_t y[] = { -_square_size / 2.0, -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0 };
+
+ scalar_t x[] = {
+ -_square_size / 2.0, _square_size / 2.0,
+ _square_size / 2.0, -_square_size / 2.0
+ };
+
+ scalar_t y[] = {
+ -_square_size / 2.0, -_square_size / 2.0,
+ _square_size / 2.0, _square_size / 2.0
+ };
+
_target = new Polygon(0.5, 1.0, 1.0, 0.0, x, y, 4);
_target->set_position(_square_size/2, _square_size/2 + (world_height - _square_size) * drand48(), 0);
_target->set_speed(0, 0, 0);
+
universe->initialize(_target);
universe->add_polygon(_target);
+
if(degree == 4) {
Polygon *obstacle;
scalar_t x[] = { ( 9 * world_width)/20, (11 * world_width)/20,
_target->set_speed(0, 0, 0);
manipulator->force_release();
return 1.0;
- } else return 0.0;
+ } else {
+ return 0.0;
+ }
}
virtual void draw(SimpleWindow *window) {