Planet::~Planet() { // Destroy content for( UInt i = 0; i < m_iMoonCount; ++i ) DestroyMoon( i ); DestroyOuterSpace(); EnumRegions( REGION_LAYER_ATMOSPHERE ); Region * pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_ATMOSPHERE, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapAtmosphereRegions.Destroy(); EnumRegions( REGION_LAYER_SURFACE ); pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_SURFACE, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapSurfaceRegions.Destroy(); EnumRegions( REGION_LAYER_UNDERGROUND ); pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_UNDERGROUND, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapUndergroundRegions.Destroy(); }
Ap_FeatureVector1D *CBC(CImage *cimg, Image *mask, int *nfeatures) { Ap_FeatureVector1D *ap_fv=NULL; int ncols, nrows, npxls; Region *r; int i, s; ncols = cimg->C[0]->ncols; nrows = cimg->C[0]->nrows; npxls = ncols * nrows; r = ComputeRegions(cimg, mask); ap_fv = (Ap_FeatureVector1D *)calloc(r->n,sizeof(Ap_FeatureVector1D)); if (ap_fv == NULL) { Error(MSG1,"AllocAp_FeatureVector1DArray"); } for (i=0; i<r->n; i++) { ap_fv[i] = CreateFeatureVector1D(6); s = r->nodes[i].s; ap_fv[i]->X[0] = r->nodes[i].L / (double) s; ap_fv[i]->X[1] = r->nodes[i].a / (double) s; ap_fv[i]->X[2] = r->nodes[i].b / (double) s; ap_fv[i]->X[3] = (r->nodes[i].h / (double) s) / (double)ncols; ap_fv[i]->X[4] = (r->nodes[i].v / (double) s) / (double)nrows; ap_fv[i]->X[5] = s / (double) npxls; } *nfeatures = r->n; DestroyRegion(&r); return(ap_fv); }
VoidSpace::~VoidSpace() { // Destroy content EnumRegions(); Region * pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapVoidRegions.Destroy(); }