void testTime(void) { Scales behavior[NUM_TESTS]; int k; int x; for (k = 0; k < num_times; k += 1) { printf("creating a random set with %d elements...", sizes[k]); fflush(stdout); createRandomSetN(sizes[k], &setsA[k], &setsB[k]); x = 10 * sizes[k]; createCopySet(&setsAPrime[k], &setsA[k]); insertSet(&setsA[k], x); insertSet(&setsAPrime[k], x + 1); insertSet(&setsB[k], x); printf("done\n"); } printf("checking scaling of isMember\n"); behavior[IS_MEMBER] = determineScaling(&isMemberTimeFun); printf("isMember's scaling appears to be: %s\n", scaling_strings[behavior[IS_MEMBER]]); printf("checking scaling of isEqualTo\n"); behavior[IS_EQUAL_TO] = determineScaling(&isEqualTimeFun); printf("isEqualTo's scaling appears to be: %s\n", scaling_strings[behavior[IS_EQUAL_TO]]); printf("checking scaling of isSubsetOf\n"); behavior[IS_SUBSET_OF] = determineScaling(&isSubsetTimeFun); printf("isSubsetOf's scaling appears to be: %s\n", scaling_strings[behavior[IS_SUBSET_OF]]); printf("checking scaling of unionIn\n"); behavior[UNION_IN] = determineScaling(&unionTimeFun); printf("unionIn's scaling appears to be: %s\n", scaling_strings[behavior[UNION_IN]]); printf("checking scaling of intersectFrom\n"); behavior[INTERSECT_FROM] = determineScaling(&intersectTimeFun); printf("intersectFrom's scaling appears to be: %s\n", scaling_strings[behavior[INTERSECT_FROM]]); printf("checking scaling of subtractFrom\n"); behavior[SUBTRACT_FROM] = determineScaling(&subtractTimeFun); printf("subtractFrom's scaling appears to be: %s\n", scaling_strings[behavior[SUBTRACT_FROM]]); printf("Performance Summary:\n"); printf("isMemberSet\t\t%s\n", scaling_strings[behavior[IS_MEMBER]]); printf("isEqualToSet\t\t%s\n", scaling_strings[behavior[IS_EQUAL_TO]]); printf("isSubsetOf\t\t%s\n", scaling_strings[behavior[IS_SUBSET_OF]]); printf("unionInSet\t\t%s\n", scaling_strings[behavior[UNION_IN]]); printf("intersectFromSet\t%s\n", scaling_strings[behavior[INTERSECT_FROM]]); printf("subtractFromSet\t\t%s\n", scaling_strings[behavior[SUBTRACT_FROM]]); }
// ----------------------------------------------------------------------- // drawMap() - Called from draw fun, it tells our specific map to draw. // ----------------------------------------------------------------------- void MapDrawer::drawMap(const int zone, const int idx) { if (myMap != 0 && pagers[idx] != 0 && showMap && getDisplay() != 0){ // Update the tiles for the pager pagers[idx]->updateTextures(textureRow[idx], textureCol[idx]); // Set up for drawing lcColor3(mapIntensity, mapIntensity, mapIntensity); glPushMatrix(); // Not centered, move the whole map down the displacement value. if (!getCentered()) { LCreal dis = getOuterRadius(); //LCreal scale = getScale(); LCreal myScale = vpHL / dis; glTranslatef(0, GLfloat(getDisplacement() * myScale), 0); } glTranslatef(0, 0, -0.1f); sinAng = 0.0f; cosAng = 1.0f; // Set the scale, if not the CENTER_PAGER if (idx != CENTER_PAGER) determineScaling(idx); bool nu = getNorthUp(); if (!nu) { GLfloat hdg = (GLfloat) getHeadingDeg(); glRotatef(hdg, 0.0f, 0.0f, 1.0f); sinAng = (LCreal)lcSin(hdg * (LCreal)Basic::Angle::D2RCC); cosAng = (LCreal)lcCos(hdg * (LCreal)Basic::Angle::D2RCC); } // Translate down the pixels first float transPixelX = -pixelCol[idx] * scalingEast[idx]; float transPixelY = pixelRow[idx] * scalingNorth[idx]; // Translate to the next tile glTranslatef(transPixelX, transPixelY, 0.0f); TextureTable& tbl = pagers[idx]->getTable(); int si = tbl.getLowerBoundIndex(); int i1 = si; int i = 0; int lb = 0, ub = 0; // Enable texturing glEnable(GL_TEXTURE_2D); lb = tbl.getLowerBoundIndex(); ub = tbl.getUpperBoundIndex(); for (i = lb; i <= ub; i++) { int j1 = si; for (int j = lb; j <= ub; j++) { drawTexture(i1, j1, idx); j1++; } i1++; } glDisable(GL_TEXTURE_2D); // Done drawing tiles, now draw grid, if selected to draw. if (drawGrid) { i1 = si; for (i = lb; i <= ub; i++) { int j1 = si; for (int j = lb; j <= ub; j++) { goDrawGrid(i1, j1, idx); j1++; } i1++; } } glPopMatrix(); } }