Esempio n. 1
0
bool in_cone ( tVertex a, tVertex b )

/******************************************************************************/
/*
  Purpose:

    IN_CONE returns TRUE iff the diagonal (A,B) is strictly internal.

  Discussion:

    More correctly, the diagonal (A,B) must be strictly internal to the
    polygon in the neighborhood of the A endpoint.

  Modified:

    30 April 2007

  Author:

    Joseph O'Rourke

  Parameters:

    Input, tVertex A, B, two vertices of the polygon.

    Output, bool IN_CONE, is TRUE if the line connecting A and B is
    strictly internal to the polygon in the neighborhood of A.

  Local Parameters:

    Local, tVertex A0, A1, are the vertices before and after A.
*/
{
  tVertex a0;
  tVertex a1;
  bool value;

  a1 = a->next;
  a0 = a->prev;
/*
  If A is a convex vertex ...
*/
  if ( left_on ( a->v, a1->v, a0->v ) )
  {
    value = left ( a->v, b->v, a0->v ) &&
            left ( b->v, a->v, a1->v );
  }
/*
  Else A is reflex vertex:
*/
  else
  {
    value = !( left_on ( a->v, b->v, a1->v ) &&
               left_on ( b->v, a->v, a0->v ) );
  }
  return value;
}
Esempio n. 2
0
void circle(void){
  //motor_straight(2);
  int i = 0;
  while(i<80){
    left_on(13);
    //five_msec_sleep(150);
    left_off();
    right_on(3);
    //five_msec_sleep(10);
    right_off();
    i++;
  }
}
Esempio n. 3
0
void motor_straight(unsigned int time){
  // Function to run both motors to make a straight line for a specified time.
  //Time_Sequence = 0;
  tmp = time + Time_Sequence;
  int i = 0;
while(i<60)
  {  
    //five_msec_sleep(STRAIGHT_SYNCH);
    right_on(3); // On for 500 ms
    right_off();
    left_on(5);
    left_off();
    //five_msec_sleep(1);
    //Time_Sequence++;
    i++;
  }
  left_off();
  right_off();
}