CS 395/495  IBMR-- Project 1: Projective 2D Warps in 3D 

This project's goals are to:

1)Review some basic object-oriented OpenGL programming, enough to apply projective geometry to images.  

2) Interactively experiment with projective 2-space transformations.   I want you to be able to see what the math describes by implementing it as 3D rendered objects. 

Instructions:

1) Download the 'starter' code I wrote for you (and will continue to refine)

Proj1_02.zip  Matrx_01.zip  

(4/14/03: Newer Version:   ProjA_05.zip has complete BMP file class: lets you read/write a texture map image.)
(4/22/03 Newer Version:   ProjA_09.zip
--adds fancy silvery lighting for transparent 'rubber sheet' and 2 triangles (one pierces the sheet and moves), 
--[try this: uncomment the quikGL.cpp  line that calls "meshWrinkle(0.1f); ],
--Automatic scaling in CquikMeshImg::drawMe(); width or height is always 1.0 for any BMP image.
--adds keyUp(), keyDown() member functions to quikGL class (try this; push 1,2,3,4 and arrow keys).

and examine the contents. Matrx_01 is a matrix class that you can ignore for now; we'll use it later.  Proj1_02 holds the latest version of the starter code.  Of these files, only two pairs are really important: all the rest can be generated from them:
    quikGL.h, quikGL.cpp    -- The quikGL C++ class takes care of most (all?) of the pesky details needed to write an  interactive, 3D animated OpenGL program under Visual C++/Microsoft Foundation Classes (MFC), even if you've never used MFC before.  The quikGL.h file header gives you step-by-step instructions to create a working program that includes mouse-driven viewing changes, animation, lighting, materials, texture mapping, image compositing, vertex lists, on-screen and 3D-positioned text and images, and file open/close.
    quikMeshImg.h, quikMeshImg.cpp -- A class for a 3D  'rubber sheet' image, written for use with quikGL.  Objects of this class describe a semi-transparent color image on-screen, texture-mapped onto a rectangular grid of vertices placed in 3D.  You can displace those vertices to stretch and shape the image into a 3D  shape, just like a rubbery sheet.  Texture mapping, file loading, shading, etc. are done for you.

2) Compile and run the Visual C++ project as-is; it should work fine.  If  you're not familiar with Windows MFC programming,  then I suggest you delete all the files except quikGL.h,quikGL.cpp, quikMeshImg.h quikMeshImg.cpp,
and follow the directions in quikGL.h to build your own MFC-based project from scratch.  (also, please send me corrections to the instructions if you find them).

3) Write a 'CP2Point' class:
A CP2Point object describes a single point (x1,x2,x3) in P2 projective space.  It has member functions that let you draw the point as either a point-like object in 3D (such as the little box used for the axis origins), and/or on the (x,y,-1) plane,  and/or as a 3D ray (like the blue,waving ray shown in Proj_02.zip). Enable/disable flags control each of these individually.
Save a copy of all your code/project in a separate directory once it works.

4) Write a 'CP2Line' class:
A CP2Line object describes a single line (e1,e2,e3) in P2 projective space.  It has member functions that let you draw the line as a line in the (x,y,1) plane and/or as a 3D transparent plane. Be clever here--make something that looks good.  For example, you might show only a portion of the plane extending from (0,0,0) through (and past) the portion of the P2 line that intersects with the (x,y,-1) plane. Save a copy of all your code/project in a separate directory once it works.

5) Write a 'CP2H' class:
A CP2H object describes a P2 projective matrix H, just like the ones we use in class.  It has member functions that let you transform a point object (x1,x2,x3) and transform a line (e1,e2,e3) object. Save a copy of all your code/project in a separate directory once it works.

 6) Add members to the quikMeshImg class (or a new derived class of your own): 
    --Add 4 or more CP2Point objects
    --Add 2 or more CP2Line objects.
--Write member functions that position the lines to pass through a given pair of these points
--Though you MAY wish to write member functions that let you click-and-drag the points along the (x1,x2,-1) plane, this is can be difficult (and irrelevant) to program.  Instead, you may use keyboard input to select and move the points and lines. Please follow these guidelines for keyboard input:
    --Use number keys to select one of the CP2Point objects: (1,2,3,.... etc.), or
    --Use the SHIFT key with the number keys to select one of the CP2Line objects (SHIFT 1,SHIFT 2, SHIFT 3,...etc.).
    --Use arrow keys to move the selected object:
        --Right/Left Arrow keys increase/decrease the x1 value;
   
     --Up/Down Arrow keys increase/decrease the x2 value;
   
     --SHIFT Up/Down Arrow keys increase/decrease the x3 value.
You should be able to use this simple keyboard input scheme for future parts of the project too.

7) Demonstrate that your CP2H class works by transforming lines and points in a quikMeshImg object by some pre-defined H matrices (but the H matrix entries should be variables--we'll have programs change them later. Save a copy of all your code/project in a separate directory once it works.