EXERCISE: Suppose the overall MC bounding box returned from Controller::getOverallMCBoundingBox and passed into set3DViewingInformation is:
For both Viewing Strategy #1 and #2, answer the following:
void set3DViewingInformation(double overallMCBB[]) { // ENTRY: overallMCBB has the MC xyz limits of the scene you created. // IF using Viewing Strategy #1 THEN // Tell class ModelView we initially want to see the whole scene: // 1. ModelView::setMCRegionOfInterest(overallMCBB); // ELSE (Viewing Strategy #2) // 1. Adjust the incoming overallMCBB so that all three Δs: // (i) are the same, (ii) reflect the desired field of view, and // (iii) do not alter the midpoint of the overallMCBB. // 2. ModelView::setMCRegionOfInterest(modified_overallMCBB); // 3. Tell the ModelView class that dynamic rotations are to be done about the eye. // // In either case, the ROI can be changed interactively at any time. // The MC ROI is used in ModelView::getMatrices to compute the eye coordinate // x and y extents of the viewing frustum on the projection plane. // MC ⇒ EC: // Determine an initial view of your scene: // Our approach: create the line of sight through the center of the scene: // 1. Center of attention should be midpoint of overallMCBB // 2. Eye point should be: Eye = Center + vector, for some suitable vector. // 3. up vector needs to be set according to your desired MC "up" direction. // Our implementation of projection transformation assumes the line of sight // is through the center of the scene! cryph::AffPoint eye(0, 0, 1), center; // compute values as stated above! cryph::AffVector up(0,1,0); // compute a value as stated above! ModelView::setEyeCenterUp(eye, center, up); // EC ⇒ LDS // Specify the projection type desired (initial value; can be changed interactively) ModelView::setProjection(PERSPECTIVE); // Determine the EC z parameters for the projection you want. (The EC (x, y) // limits will be set during display callbacks in getMatrices as we will see.) // 1. ecZmin and ecZmax need to be set based on the DISTANCE between the eye // point and the center of attention so as to ensure that unwanted depth // clipping does not occur. // CONSTRAINTS: (i) ecZmin < ecZmax; (ii) if perspective, ecZmax < 0. // (This will be used in ModelView::getMatrices to set the eye coordinate z // extent of the viewing frustum.) double ecZmin = -2.0, ecZmax = -0.05; // compute values as stated above! ModelView::setECZminZmax(ecZmin, ecZmax); // 2. Place the projection plane. One possible initial placement is at the // front of the scene, e.g.: ecZpp = ecZmax. We will discuss in class // other possible projection plane placements and how to decide what you want. // CONSTRAINT: if perspective: ecZpp < 0 // (This will be used in ModelView::getMatrices to set the eye coordinate z // location of the projection plane which is perpendicular to the eye // coordinate z-axis.) double ecZpp = -1.0; // compute a value as stated above! ModelView::setProjectionPlaneZ(ecZpp); }