Exemple #1
0
static int mouse_press (Viewer *viewer, EventHandler *ehandler,
                        const double ray_start[3], const double ray_dir[3],
                        const GdkEventButton *event)
{
    RendererGoal *self = (RendererGoal*) ehandler->user;

    double xy[2];
    geom_ray_z_plane_intersect_3d(POINT3D (ray_start), POINT3D (ray_dir), 
            0, POINT2D (xy));

    int consumed = 0;

    int control = event->state & GDK_CONTROL_MASK;

    pthread_mutex_lock (&self->mutex);

    // select a previously selected goal?
    if (event->button == 1 && ehandler->picking) {
        self->edit_goal = find_goal(self, xy);
        consumed = 1;
    } 

    if (event->button == 1 && control && ehandler->picking &&
            self->edit_goal == NULL) {
        // create a new goal
        lcmtypes_goal_t g = {
            .pos = { xy[0], xy[1] },
            .size = { 1, 1 },
            .theta = 0,
Exemple #2
0
/* construct our ant */
static void build_ant(antspotlightstruct *mp)
{
  mp->ant = (Ant *) malloc(sizeof (Ant));
  mp->ant->position[0] = 0.0;
  mp->ant->position[1] = 0.0;
  mp->ant->position[2] = 0.0;
  mp->ant->direction = 0.0;
  mp->ant->velocity = 0.02;
  mp->ant->material = MaterialGray5;
  mp->ant->step = 0;
  find_goal(mp);
}
Exemple #3
0
/* find a new goal and reset steps */
static void reset_ant(antspotlightstruct *mp)
{
  find_goal(mp);
}