Builder/Builder/Common/plyfile.c
/******************************************************************************
Describe an element, including its properties and how many will be written
to the file.

Entry:
  plyfile   - file identifier
  elem_name - name of element that information is being specified about
  nelems    - number of elements of this type to be written
  nprops    - number of properties contained in the element
  prop_list - list of properties
******************************************************************************/
Describe an element, including its properties and how many will be written
to the file.


Describe an element including its properties and how many will be written to the file .
void ply_describe_element(
  PlyFile *plyfile,
  char *elem_name,
  int nelems,
  int nprops,
  PlyProperty *prop_list
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;
  elem = find_element (plyfile, elem_name);
  if (elem == NULL) {
    fprintf(stderr,"ply_describe_element: can't find element '%s'\n",elem_name);
    exit (-1);
  }
  elem->num = nelems;
  elem->nprops = nprops;
  elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *) * nprops);
  elem->store_prop = (char *) myalloc (sizeof (char) * nprops);
  for (i = 0; i < nprops; i++) {
    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
    elem->props[i] = prop;
    elem->store_prop[i] = NAMED_PROP;
    copy_property (prop, &prop_list[i]);
  }
}
void ply_describe_element ( PlyFile * plyfile , char * elem_name , int nelems , int nprops , PlyProperty * prop_list ) { int i ; PlyElement * elem ; PlyProperty * prop ; elem = find_element ( plyfile , elem_name ) ; if ( elem == NULL ) { fprintf ( stderr , " \n " , elem_name ) ; exit ( -1 ) ; } elem -> num = nelems ; elem -> nprops = nprops ; elem -> props = ( PlyProperty * * ) myalloc ( sizeof ( PlyProperty * ) * nprops ) ; elem -> store_prop = ( char * ) myalloc ( sizeof ( char ) * nprops ) ; for ( i = 0 ; i < nprops ; i ++ ) { prop = ( PlyProperty * ) myalloc ( sizeof ( PlyProperty ) ) ; elem -> props [ i ] = prop ; elem -> store_prop [ i ] = NAMED_PROP ; copy_property ( prop , & prop_list [ i ] ) ; } }
Describe an element, including its properties and how many will be written
to the file.
Describe an element including its properties and how many will be written to the file .
/* look for appropriate element */ /* copy the list of properties */