SciVis 2015 Project 1: "plotr"
Assigned Thu Jan 8; Due Fri Jan 16 at 4:59pm
This project involves material covered in the first week of class, and in Sections 4.1 and 4.2 of our Foundations of Scientific Visualization (FSV) class notes. The basic goal of this project is to implement (a one-dimensional version of) a fundamental abstraction in scientific visualization: a continuous function that is reconstructed by convolution of discrete data (located in world-space) with a continuous reconstruction kernel. You will create a utility that plots (by making a PNG image) the convolution result, and you can view the image with any normal image viewer. The "underlying data" can be generated by sampling polynomials. If you know how to graph a polynomial, you can directly see if your result looks correct.
(note non-canonical due date and time)Doing this project requires understanding the math in the FSV notes (things like lerp, index-space and world-space, node-centered and cell-centered samples, and the precise definition of convolution sums for even and odd kernel supports). You do not have to write a lot of code, however: only about 150 lines of code are needed.
Logistics
Your CNETID-scivis-2015 directory should now be populated with a p1plotr directory which contains all the files for this project. As long as you have environment variable $SCIVIS set correctly, and if you are logged into one of the CSIL Macs, you should be able to type make in p1plotr to build the plotr executable. You should also have a reference executable rplotr which you should use for comparison and debugging.You can work individually or in pairs for this project. To pair up with another student, try the following:
If you are able to create a pair repo, but it is not seeded with the p1plotr files, ask a question in the project1 folder on Piazza.
- Log into https://work-groups.cs.uchicago.edu
- Click on "Manage an assignment group work", then "Start a new group", then "CMSC-23710-Winter-2015". Even if you are registered in 33710, you will use the 23710 class identifier for the purposes of forming pairs.
- Click on "Project 1: plotr (p1plotr)" and then select the person you want to pair with (according to his or her CNetID), and then "Send Invites".
- The other person in the pair will have to go through the same steps, to request pairing with you.
- You should get information about a new per-pair repository, which should be seeded with all the p1plotr files. Use this new repo for this project: neither of the individual repos will be graded..
What to do
The technical information about this project is in the source files, and embedded in the rplotr executable, rather than spelled out here. To start, you should run "./rplotr" to review all the commands available, and you should then run "./rplotr about" to learn more about how plotr works, and to see the four source files you should be editing, to complete the implementation of which functions, to be tested with which plotr commands. As indicated there, your coding should probably start by filling in the implemention of pltLerp() in util.c; this function will come in very handy. You can test your implementation with "make && ./plotr lerp", for which you supply five argments to lerp on the command-line. Compare your results with ./rplotr lerp. For later functions and commands, be sure you have read through the header file plt.h to understand the fields of the pltKernel and pltData structs that are used in convolution. In particular, kernels know their own support and their own derivatives, and the data includes meta-data about where samples are located within some interval.For each of the plotr X commands corresponding to a function you need to implement (listed in the output of plotr about), you should carefully read the usage information (generated by "plotr X") to make sure you understand the purpose of the command and the meaning of its command-line options. You can also scrutinize the implementation of the command (in plotr_X.c) to see how the underlying C function is being called.
Throughout the code you will see some unfamiliar functions, like airMop for memory management, biffAdd/biffGet for error messages, and hest for command-line parsing. These functions come from Teem (scivis-2015/teem-install/lib/libteem.a). You should not to worry about them since you will not be writing any Teem-related functions to complete the required functions.
For this project there is no additional work for 33710 students to do relative to 23710 students.
Completing the work
In the definition of functions that you have to implement, you will see lines:DO NOT EDIT THESE LINES (the ones with v.v.v.v and ^'^'^'^'^), or anything outside the regions that they delineate. The amount of blank lines in these regions is a general indication of how many lines of code you need to fill in (it is actually the exact the number of lines in the reference implementation, but don't get too concerned about that). You may add new variable definitions anywhere with these code region (it will certainly be needed for the longer functions)./* v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v begin student code */ /* ^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^ end student code */You should make a habit of frequently typing make to make sure that everything still compiles without problems. One of the make targets is an integrity check that verifies checksums of the files you should not be editing, and the portions outside the "student code" blocks in the files you should be editing.
At the start of the functions that you have to implement, there is a comment block that defines what the inputs and outputs to the function should be; this provides the technical definition of what a correct implementation should be. The reference implementation rplotr should conform to this.
Example plotr commands to try
For all of these examples (and for this project in general), your goal is to make your plotr program act the same as the reference implementation rplotr.First, see the examples in Lab 1.
Also, be able to make graps of the convolution kernels, by convolving them with data that is all 0 except for a single 1, as with:
Then edit delta.txt so that the middle 0 (on line 9) is instead 1. Then try (compare the output of plotr and rplotr)./rplotr psamp -p 0 -mm -4 4 -n 9 -c node -o delta.txtThen try adding "-d 1", or "-d 2" to all these, while adjusting the vertical range to something like "-ymm 1.9 -1.9" or wider../plotr plot -i delta.txt -k box -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o box.png ./plotr plot -i delta.txt -k tent -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o tent.png ./plotr plot -i delta.txt -k bspln2 -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o bspln2.png ./plotr plot -i delta.txt -k bspln3 -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o bspln3.png ./plotr plot -i delta.txt -k ctmr -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o ctmr.png ./plotr plot -i delta.txt -k c4hexic -xmm -4.1 4.1 -ymm 1.2 -1.2 -s 800 600 -thp 12 -r 15 -o c4hexic.pngTo make sure differentiation is correctly happening in world-space, you can first sample some polynomial, like f(x) = -x + x^3, and make sure that its reconstruction agrees with the polynomial at the sample points (and that the zero-crossings show up at the right place):
and then you can plot the derivative of the reconstruction, along with the analytic derivative of the polynomial f'(x) = -1 + 3x^2, to make sure they agree too, for a variety of kernels./plotr psamp -p 0 -1 0 1 -mm -1.3 1.3 -n 8 -c node -o 08.txt ./plotr plot -i 08.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p 0 -1 0 1 -thp 5 -tha 4 -hz 40 -o plot08.pngAnd then change the sampling density significantly:./plotr plot -d 1 -i 08.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -o plot08d.png ./plotr plot -d 1 -i 08.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -k bspln2 -o plot08d-bspln2.png ./plotr plot -d 1 -i 08.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -k ctmr -o plot08d-ctmr.png./plotr psamp -p 0 -1 0 1 -mm -1.3 1.3 -n 40 -c node -o 40.txt ./plotr plot -i 40.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p 0 -1 0 1 -thp 5 -tha 4 -hz 40 -o plot40.png ./plotr plot -d 1 -i 40.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -o plot40d.png ./plotr plot -d 1 -i 40.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -k bspln2 -o plot40d-bspln2.png ./plotr plot -d 1 -i 40.txt -xmm -1.4 1.4 -ymm 1.5 -1 -p -1 0 3 -thp 5 -tha 4 -k ctmr -o plot40d-ctmr.pngGrading
The grade will be based on correctness (80%) and style (20%). If your code does not compile cleanly, with the Makefile provided, you will get a ZERO for correctness. For the style points, keep in mind:
- You may not put new functions in new .c files, and #include these into any of the given .c files that you may edit.
- The function comments note things that are disallowed (like using pow() in pltPolyEval), as well as things that you don't need to clever about (like the implementation of the per-data-point dots in pltPlot). The implementation of the zero-crossing tick-marks should also stress correctness over efficiency.