/* ============================================================================= * 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(®ion_elementlistcompare); assert(regionPtr->beforeListPtr); regionPtr->borderListPtr = PLIST_ALLOC(®ion_listcompareedge); assert(regionPtr->borderListPtr); regionPtr->badVectorPtr = PVECTOR_ALLOC(1); assert(regionPtr->badVectorPtr); } return regionPtr; }
/* ============================================================================= * 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; }