Revision 1115
Smart run around mostly works!!!
Thanks to Brian for fixing a bug in motion code
divide by 0 zero error in motion.c
Makefile cleans .csim and copy it over
GUI no longer fill the robot
gtk_environment_view.c | ||
---|---|---|
248 | 248 |
view->mouseY = event->y; |
249 | 249 |
view->mouseDown = 1; |
250 | 250 |
|
251 |
closestdist = 10e8; |
|
251 |
closest = -1; |
|
252 |
closestdist = 10e16; |
|
252 | 253 |
to_world_coordinates(view, event->x, event->y, &x, &y); |
253 | 254 |
robot_iterator_reset(); |
254 | 255 |
while ((r = robot_iterator_next()) != NULL) |
255 | 256 |
{ |
256 | 257 |
float dx = r->pose.x - x; |
257 | 258 |
float dy = r->pose.y - y; |
258 |
float dist = dx * dx + dy * dy;
|
|
259 |
float dist = sqrt(dx * dx + dy * dy);
|
|
259 | 260 |
if (dist < closestdist) |
260 | 261 |
{ |
261 | 262 |
closestdist = dist; |
... | ... | |
287 | 288 |
view->mouseDown = 0; |
288 | 289 |
robots_pause(); |
289 | 290 |
r = robot_get(view->selected_robot); |
290 |
to_world_coordinates(view, view->mouseX, view->mouseY, |
|
291 |
if (r != NULL) |
|
292 |
to_world_coordinates(view, view->mouseX, view->mouseY, |
|
291 | 293 |
&r->pose.x, &r->pose.y); |
292 | 294 |
robots_resume(); |
293 | 295 |
} |
... | ... | |
516 | 518 |
int rox, roy; |
517 | 519 |
if (!drawable || !gc) |
518 | 520 |
return; |
519 |
|
|
521 |
|
|
522 |
selected = 0; |
|
523 |
|
|
520 | 524 |
to_window_scale(view, ROBOT_DIAMETER, &rx); |
521 | 525 |
to_window_scale(view, ROBOT_DIAMETER, &ry); |
522 | 526 |
to_window_coordinates(view, x, y, &rox, &roy); |
Also available in: Unified diff