Esempio n. 1
0
void MakeOneSubHull(tVertex vexc, tVertex fverts, tEdge fedges, tFace ffaces)
{
  int vnum = 0;
  tVertex v, v1;

  vertices = NULL;
  edges = NULL;
  faces = NULL;

  v1 = fverts;
  do 
    {
      if(v1 != vexc)
	{
	  v = MakeNullVertex();
	  v->v[X] = v1->v[X];
	  v->v[Y] = v1->v[Y];
	  v->v[Z] = v1->v[Z];
	  v->vnum = vnum++;
	}
      v1 = v1->next;
    } 
  while(v1 != fverts);

  chMakeFullHull();
}
Esempio n. 2
0
void chAddPoints(int n, const int *pos)
{
  tVertex v;
  int i, vnum;

  if(vertices == NULL) vnum = 0; else vnum = vertices->prev->vnum;

  for(i=0; i<n; i++)
    {
      v = MakeNullVertex();
      v->v[X] = pos[3*i+0];
      v->v[Y] = pos[3*i+1];
      v->v[Z] = pos[3*i+2];
      v->vnum = vnum++;
    }
}
Esempio n. 3
0
/*---------------------------------------------------------------------
ReadVertices: Reads in the vertices, and links them into a circular
list with MakeNullVertex.  There is no need for the # of vertices to be
the first line: the function looks for EOF instead.
---------------------------------------------------------------------*/
void   ReadVertices( void )
{
   tVertex	v;
   int		x, y;
   int		vnum = 0;

   while ( scanf ("%d %d", &x, &y ) != EOF )  {
      v = MakeNullVertex();
      v->v[X] = x;
      v->v[Y] = y;
      v->vnum = vnum++;
   }
   nvertices = vnum;
   if (nvertices < 3) 
      printf("%%Error in ReadVertices: nvertices=%d<3\n", nvertices),
      exit(EXIT_FAILURE);
}
Esempio n. 4
0
/*---------------------------------------------------------------------
ReadVertices: Reads in the vertices, and links them into a circular
list with MakeNullVertex.  There is no need for the # of vertices to be
the first line: the function looks for EOF instead.  Sets the global
variable vertices via the ADD macro.
---------------------------------------------------------------------*/
void	ReadVertices( void )
{
   tVertex  v;
   int      x, y, z;
   int	    vnum = 0;

   while ( scanf ("%d %d %d", &x, &y, &z ) != EOF )  {
      v = MakeNullVertex();
      v->v[X] = x;
      v->v[Y] = y;
      v->v[Z] = z;
      v->vnum = vnum++;
      if ( ( abs(x) > SAFE ) || ( abs(y) > SAFE ) || ( abs(z) > SAFE ) ) {
         printf("Coordinate of vertex below might be too large: run with -d flag\n");
         PrintPoint(v);
      }
   }
}