Ejemplo n.º 1
0
Archivo: region.c Proyecto: riclas/rstm
/* =============================================================================
 * Pregion_alloc
 * =============================================================================
 */
region_t*
Pregion_alloc ()
{
  region_t* regionPtr;

  regionPtr = (region_t*)P_MALLOC(sizeof(region_t));
  if (regionPtr) {
    regionPtr->expandQueuePtr = PQUEUE_ALLOC(-1);
    assert(regionPtr->expandQueuePtr);
    regionPtr->beforeListPtr = PLIST_ALLOC(&region_elementlistcompare);
    assert(regionPtr->beforeListPtr);
    regionPtr->borderListPtr = PLIST_ALLOC(&region_listcompareedge);
    assert(regionPtr->borderListPtr);
    regionPtr->badVectorPtr = PVECTOR_ALLOC(1);
    assert(regionPtr->badVectorPtr);
  }

  return regionPtr;
}
Ejemplo n.º 2
0
/* =============================================================================
 * Pelement_alloc
 *
 * Contains a copy of input arg 'coordinates'
 * =============================================================================
 */
element_t*
Pelement_alloc (coordinate_t* coordinates, long numCoordinate)
{
    element_t* elementPtr;

    elementPtr = (element_t*)P_MALLOC(sizeof(element_t));
    if (elementPtr) {
        long i;
        for (i = 0; i < numCoordinate; i++) {
            elementPtr->coordinates[i] = coordinates[i];
        }
        elementPtr->numCoordinate = numCoordinate;
        minimizeCoordinates(elementPtr);
        checkAngles(elementPtr);
        calculateCircumCircle(elementPtr);
        initEdges(elementPtr, coordinates, numCoordinate);
        elementPtr->neighborListPtr = PLIST_ALLOC(&element_listcompare);
        assert(elementPtr->neighborListPtr);
        elementPtr->isGarbage = false;
        elementPtr->isReferenced = false;
    }

    return elementPtr;
}