Subject: Assn 1 and other info (This message is being sent to all CPSC 215 students and TA's) This is a test of the facility that will be used to distribute information to the class. If you are no longer in the class and would like your name removed please let me know. If you are in the class and DON"T get this message you should let me know also ;-) ------------------------------- Regarding assn 1, a student asks: > Are we allowed to use an array to store the values we find for the > number of rows and columns in the header? Since use of an array was suggested in the solution to the lab, there will be NO DEDUCTION for using an array FOR ACCUMULATING ELEMENTS OF THE .ppm header. However, it is a useful exercise that will help you in the remainder of the course if you try to do this without using the array. Subject: notes corrected / gdb (This message is being sent to all CPSC 215 students and TA's) I have corrected the bugs in the zstrcat() functions in the notes. Machine editable copies of the function may also be found in programs p12b.c and p12c.c in the examples directory. ------------------- To use gdb with standard input redirection: gdb a.out b main run < myfile.ppm ------------------- Note: the last time I checked the gdb on the solaris systems was suffering from moderate brain damage. The symptom is that in the above scenario it will look for "myfile.ppm" only in your HOME DIRECTORY. Thus the easiest solution is to put it there! An alternate solution requiring more typing is: run < /home/joeuser/class/215/assn1/myfile.ppm Subject: Development environments (This message is being sent to all CPSC 215 students and TA's) Several folks seem to have overlooked the first paragraph of the specification which says that input MUST come from stdin and output MUST go to stdout. Any program that contains fopen() is broken. --------------------------------------------------------- I generally recommend AGAINST doing your development on your Windows machine if you can possibly avoid that. As mentioned earlier a good way to avoid it is to have the fine folks at CLUG help you convert your laptop to a dual boot machine that runs Linux. If you should try to use Visual Studio, you should be aware that Mr. Gates will inspect EVERY byte you write to stdout with printf() or fwrite() and if he sees \n = 0x0a he will convert it to the two byte sequence 0x0d 0x0a Needless to say, this will have a negative impact on the quality of your image! He will also do the reverse on input -- converting every instance of 0x0d0x0a to 0x0a. The only way I know to defeat this behavior is something along the lines of the following: FILE *myout; FILE *myin; #ifdef MSWARE myin = fopen("bill_in.ppm", "rb"); stdin = myin; myout = fopen("bill_out.ppm", "wb"); stdout = myout; #endif This should disable redirection and all writes to the standard out should go to file bill_out.ppm Advanced M$ programmers may know of a better way to do this. Subject: Hint on compiling (This message is being sent to all CPSC 215 students and TA's) When compiling your programs, I strongly recommend the use of the -Wall flag as in: gcc -g -Wall p3.c The -Wall flag instructs the compiler to be a picky as possible when warning about possible misuse of the C language. An excellent rule of thumb is: NEVER try to actually run any program until gcc -Wall produces ZERO warning messages. Subject: Implicit declaration warning messages (This message is being sent to all CPSC 215 students and TA's) A student asks, where to these guys come from and how do I get rid of them?? p4.c:11: warning: implicit declaration of function `exit' p4.c:14: warning: implicit declaration of function `malloc' p4.c:30: warning: implicit declaration of function `strtol' p4.c:55: warning: implicit declaration of function `atoi' An implicit declaration means that you called a function (er, method) for which no prototype was provided. In Java or C++ this is a compile time fatal error. In C you will just get a warning but you may have an execution time fatal error! The solution is to use the "man" command to lookup the function. (Don't forget to tell it to look in section 3C on solaris). The man page will show you which of include files contains the prototype you need. Here it is #include ------------------------------------------------------- man -s3C exit NAME exit, _exithandle - terminate process SYNOPSIS #include void exit(int status); Subject: How to submit assignment 1 (This message is being sent to all CPSC 215 students and TA's) NOTE: This procedure has NOTHING in common with "handin" nor "sendlab" Do NOT even TRY to think about how they fit into this procedure because THEY DON'T!! <<>> You must turn in 4 files: p1.c p2.c p3.c and p4.c If you used any private .h files DO turn them in. 1. From a departmental Solaris system rlogin to workstation jmw 2. The submission directories lie in the directory /local/jmw2/215/a1 which is available ONLY IF YOU HAVE LOGGED INTO WORKSTATION jmw. Each student has a subdirectory of /local/jmw2/215/a1. The name of your subdirectory is your userid (in the example we will assume your id is wjsmith). 3. copy (via the cp command) required files to your subdirectory in /local/jmw2/215/a1 For example: cp /home/wjsmith/215/a1/*.c /local/jmw2/215/a1/wjsmith Here you would (hopefully) obviously need to replace /home/wjsmith/215/a1/*.c with wherever you have your programs. 4. don't modify the permissions on your subdirectory. They are set so that ONLY you can access your directory. ---------------- After you think you have turned your programs in, its a good idea to cd /local/jmw2/215/a1/wjsmith and make sure your files are their and they still compile and work correctly. The programs are due by Monday night at 11:59 pm, but I would recommend submitting them an hour or so early in case you hit some snags in the procedure. You may replace your submission at any time, but you will incur the appropriate late penalty if you do so after the deadline. Since the penalty grows slowly at first, if you submit a badly broken program on Monday and manage to get it working perfectly by Wednesday it is to your advantage to replace it then. Even if all you have on Monday is a badly broken program you should submit it as well, because there is no guarantee it will be any better by Wednesday. Subject: Reminder on How to submit assignment 1 (This message is being sent to all CPSC 215 students and TA's) I've noticed that several students have already turned in their assignments. This is excellent! Unfortunatly some of these students failed to notice: <<>> The reason for this regulation is that if many students ignore it, the turnin space will fill up and late turnerinners will unable to turnin at all :-( A mean-spirited early turnerinner might think: EXCELLENT those late turnerinners will lose even more points :-). But, alas, such is not the case. Late turnerinners will send me nastygrams telling me their troubles. And I will have to "bill" the non-compliant early turnerinners points for every file that I have to manually remove from their directory at 2:00 am. Subject: Assignment 1 evaluations (This message is being sent to all CPSC 215 students and TA's) I will be sending out evaluations of assignment 1 shortly. These were graded by me on system jmw. The script used to test is called doit and is in the assn1data directory. If you would can't replicate the problems I have reported feel free to stop by my office and I'll be happy to show you the problem. Subject: Assignment 2 and notes update (This message is being sent to all CPSC 215 students and TA's) I've replaced the assn 2 specification and todays notes with cleaned up versions. Subject: Assn 2 - Milestone 1 (This message is being sent to all CPSC 215 students and TA's) For milestone 1 you should have the following C modules: main.c list.c view.c model.c sphere.c plane.c veclib3d.c For milestone 2 you will need to add image.c raytrace.c There is a discussion of how to build multi-module programs in the area of pages 85-90 in the notes. Subject: Assignment 2 test data and output (This message is being sent to all CPSC 215 students and TA's) I have placed some sample input and output for assignment 2 in the assn2data subdirectory of the assns directory. .txt -> model description .out -> sample stderr .ppm -> image These are thought (but not guaranteed) to be correct. If you think you see an error please let me know. Subject: Dealing with the dreaded "priv" pointer (This message is being sent to all CPSC 215 students and TA's) Assuming one has declared: typedef struct obj_type { : : void *priv; : } obj_t; typedef struct sphere_type { double radius; : } sphere_t; and has properly set "priv" to point to an instance of the sphere_t and one is passed a valid pointer of type: obj_t *obj; then it is NOT POSSIBLE to dereference said pointer in the following way: r = obj->priv->radius; The simplest way to assign the radius to r is to declare: sphere_t *sphere; sphere = (sphere_t *)obj->priv; r = sphere->radius; Simply doing sphere_t *sphere; sphere = obj->priv; r = sphere->radius; will also WORK correctly but will produce a nastygram warning. A complex construction along the lines of: r = ((sphere_t *)(obj->priv))->r; will also work but is not recommended. Subject: How to ask for help (This message is being sent to all CPSC 215 students and TA's) If you get stuck on a problem with your program and want to ask me or one of the TA's for help via e-mail, here is the way to go about it: (1) cd the directory that holds your source and be sure to ---remove core files and old image files not relevant to the problem at hand--- (2) create a tar file by entering the command: tar cvf ms1.tar . (don't worry about the warning saying that ms1.tar was not recursively added to itself) (3) compose an email describing the problem as precisely as possible (4) attach the tar file to the email and send it. Sending of code snippets is discouraged for the following reason (1) you don't know whats wrong because if you did you would fix it! (2) since you don't know whats wrong you also don't know what snippets are relevant to the resolution! Sending of zip (instead of tar) files is discouraged because so many M$ viruses are transmitted that way most e-mail filters remove them. Subject: Recursion in the ray tracer (This message is being sent to all CPSC 215 students and TA's) A couple of students have noticed a comment that said the raytracer is recursive and then headed --off-- the road to success by assuming that meant it should process the list of objects recursively. That assumption would be FALSE. The raytracer will eventually become recursive --when we get to specular lighting--. Specular lighting models the effect of shiny metal surfaces or mirrors and the recursion is based upon the bouncing of the ray off of one surface and hitting another. But since we aren't yet there, this version should have NO RECURSIVE CALLs to the raytracer AT ALL! Again raytrace does NOT process the object list recursively. It should process the list iteratively -- or better still call a function called find_closest_object() that does. obj_t *find_closest_object(...) { obj_t *testobj; testobj = list->head; while (testobj != NULL) { process it testobj = testobj->next; } } Sorry for the confusion there. mw Subject: Care and feeding of header files (This message is being sent to all CPSC 215 students and TA's) A number of folks seem to have forgotten my warning that entities in C MUST BE DEFINED BEFORE THEY ARE REFERENCED. Thus if you list_t contains references to obj_t the definition of the obj_t must come before the definition of the list_t in the .h file. (For now there is no need for any circular dependencies in your program so DON"T worry about that case). Also if you include prototypes of functions, and the prototypes use structures such as obj_t or view_t the prototypes must be included AFTER the structures are defined. Subject: .rar archives (This message is being sent to all CPSC 215 students and TA's) Two folks have sent me .rar archives instead of the .tar I requested. I don't know what these are nor how to decode them. So please send .tar as requested ------------------------------------------------------------- (1) cd the directory that holds your source and be sure to ---remove core files and old image files not relevant to the problem at hand--- (2) create a tar file by entering the command: tar cvf ms1.tar . (don't worry about the warning saying that ms1.tar was not recursively added to itself) (3) compose an email describing the problem as precisely as possible (4) attach the tar file to the email and send it. Subject: Proper use of typedefs (This message is being sent to all CPSC 215 students and TA's) Several students have reported errors of the following type: "dereferencing pointer to incomplete type." This problem is commonly caused by CORRECTLY declaring typedef struct obj_type { int objtype; : } obj_t; This declaration creates two legitmate type names that can be used in your programs: (1) struct obj_type (2) obj_t but (3) struct obj_t is NOT ONE OF THEM. In summary: struct obj_type *obj; /* GOOD! */ obj_t *obj2; /* GOOD TOO */ struct obj_t *obj3; /* bad */ -------------------------------------------------------------- Another common problem is incomplete types in function prototypes. To avoid this one ensure that STRUCTURE DEFINITIONS precede PROTOTYPE DEFINITIONS in your includes. Subject: How to run your program (This message is being sent to all CPSC 215 students and TA's) A student asks: > When I run my ray file created using gcc -o ray -g all .c files > -lm -Wall , It says ray: Command not found. Do you know why this > might be? If you should encounter this problem, first be sure that ray exists and is executable in your directory: /local/jmw6/acad/cs215/examples/mwray12 ==> ls -l ray -rwx------ 1 westall xusers 96034 Feb 23 20:27 ray ------------------------------------ Assuming ray is alive, well, and executable, the next obstacle is that there is a theory in system administration that having your working directory in the executable PATH is DDAANNGGEERROOUUSS. This theory is based upon the FACT that if a bad guy has compromised your account or you have given your password to a bad guy, then the bad guy could place a shell script named "gcc" in your assn2 directory and the next time you enter gcc the bad guy's script can wipe out all of your files after sending 50 bezillion spam e-mails. Because of this, our sysadmin HATES the idea of having your current working directory in your executable program path and in our present default configuration your current working directory is NOT in your path. ------- The solution ------------- Therefore, you may well have to enter ./ray 600 400 < backwall.txt > backwall.ppm for your program to work. The . prefix is an abbreviation for the current working directory. ------------- I, personally, have always thought that if someone compromised my account, they would INSTANTLY send a bezillion spam emails, subscribe me to all the illegal prescription drug, porno, Nigerian 419, low cost pirated M$ software, and "low interest" mortage sites in the world, and then delete all my files WITHOUT planting a trojan and hoping that would cause me to do it to myself! So I have ALWAYS kept my working directory in my program path. But I use strong passwords and NNEEVVEERR give them to others. Subject: Test data reminder (This message is being sent to all CPSC 215 students and TA's) This info was distributed earlier, but in case you missed it here is a reminder: I have placed some sample input and output for assignment 2 in the assn2data subdirectory of the assns directory. .txt -> model description .out -> sample stderr .ppm -> image A program that is capable of rendering these images correctly is not necessarily correct, but a program that does not render these images correctly is definitely broken! Subject: Assn 2 - How to turn in: (This message is being sent to all CPSC 215 students and TA's) Turn in directories are now available in jmw:/local/jmw2/215/a2 Your personal subdirectory should have exactly two subdirectories named ms1 and ms2. The code in ms1 will be evaluated for existence and the code in ms2 will be graded for correctness. You should include a makefile that will build an executable named ray You should not include any corefiles, image files or diagnostic output files. In assisting students I have noticed several cases of extra long lines of source code. Remember that 72 characters is the limit. The presence of long lines will cause a deduction of up to 5 points. Deductions will also be made for inadequate modularization functionalization and commenting Finally its always a good idea to do a make and test run AFTER you copy your files to the submission directory -- but do remember to remove any output created by the test run. Subject: Assn 2 - Location of variable declarations (This message is being sent to all CPSC 215 students and TA's) I have previously requested that variable declarations be placed ONLY at the beginning of a block and placed BEFORE any executable code. The fprintf shown below is an example of a VIOLATION of this directive. 5 { 6 fprintf(stderr, "in raytrace\n"); 7 obj_t *ptr = (obj_t *)objs->head; 8 obj_t *closest = (obj_t *)objs->head; 9 obj_t *last_hit = (obj_t *)objs->tail; 10 double *hitvec = malloc(3 * sizeof(double)); 11 double *vec_diff = malloc(3*sizeof(double)); The reason for this rule is that many (older ) C compilers INCLUDING THE ONE ON MY HOME COMPUTER view the above as a SYNTAX ERROR. While I'm glad to try to help you fix execution time errors in your programs, I'm MUCH LESS GLAD to have to fix a half a dozen of these things BEFORE I can test. Subject: Assn 2 - Plane data clarification (This message is being sent to all CPSC 215 students and TA's) There is a line in the notes that said the point should precede the normal in the description of the plane. This is in conflict with the sample input in assn2data. The sample input format is correct. The normal should precede the point. Subject: Assn 2 - More on typedefs (This message is being sent to all CPSC 215 students and TA's) As student says: > You say you can only use the declaration for structs as: > > struct obj_type *obj > obj_t *obj > > but in your notes downloaded on 2/26 page 61 in the function list_init > you clearly use "struct list_t *list". Same usage for the return type > and parameters. This observation is certainly true! And it works just fine because struct list_t was defined as a structure type on p. 59 as follows: struct list_t { struct sphere_t *head; struct sphere_t *tail; }; I did NOT mean to imply that the suffixes _t or _type had any magical powers. list_t, list_type, mylist, my_list, type_list etc are ALL JUST NAMES. It is the CONTEXT in which they are defined that governs HOW THEY MUST BE USED. If a name is defined in the context struct my_new_name { }; then instances MUST be declared as struct my_new_name my_new_instance; ------------------------------------ Similarly if I define: typedef struct my_new_name { } my_magic_cookie; Then either struct my_new_name my_new_instance; or my_magic_cookie another_instance; will both work fine! but NEITHER my_new_name my_new_instance; nor struct my_magic_cookie another_instance; will work. Subject: Copying vectors in C (This message is being sent to all CPSC 215 students and TA's) Some people have tried to copy one 3-D vector to another using a single assignment statement. Examples I have seen include copying a plane's normal to the object hitpoint normal, and copying the ambient reflectivity of the object to the pixel vector. ---- That does NOT work in C ---- To copy a vector you must either (1) copy one element at a time via assignment or (2) copy the entire vector via a function such as memcpy() Subject: Mid-term test reminder (This message is being sent to all CPSC 215 students and TA's) The test will take place in class on Wednesday. The test format will be similar to the daily quizzes. The test will in fact contain many questions directly from the daily quizzes. Thus I have placed a copy of this semester's quizzes in the quizzes directory. There is also a copy of last fall's midterm test there. I don't keep answer keys so I don't have any of those. However, unlike the assignments, collaboration in studying for the tests is ENCOURAGED. So if you have been diligent in copying answers from the board feel free to share or trade with other class members. In addition to short answer questions, there will be one 10 to 15 point hand-written program writing question. Subject: Quiz D answers (This message is being sent to all CPSC 215 students and TA's) Quiz D material WILL be on the test. Answers are: 1. (c) Since P, R, Q, are points its necessary to compute differences to obtain vectors lying in the plane. 2. (b) The X axis cross the Y axis is the Z axis 3. (b) See notes on projection 4. (b) The identity is all 0's except 1's on the diagonal 5. (d) It works correctly for single component vectors such as (5, 0, 0) or (0, 0, 3) Subject: Assignment 3 specification (This message is being sent to all CPSC 215 students and TA's) assn3.s05.pdf is now available in the assns directory. Please be careful NOT to do the following things by which people lost points on assignment 2. (1) Forget to create and use ms1 ms2 directories (2) Name ms1 and ms2 directories p1 and p2 or m1 and m2 --- These rules are not arbitrary as they might first appear. --- I use a collection of automated grading tools that WON"T --- work unitl I go back and clean up your submission, so I charge --- points in exchange for my labor there (3) send me a batch of extra long lines. --------------------------------------------------------------------- (4) Engage in collaborative work. Unfortunately, two people got themselves into a heap of trouble in this way. As nearly as I can tell, the problem began ALMOST PRECISELY AS I DEMONSTRATED in my "one man playing two students" rendition on the first day of class... but I guess the HARD way is the ONLY way some folks learn. As usual this situation was detected via the presence of some truly bizarro bugs and constructs that I would never have imagined one student could come up with. The bottom line is the even if you collaborate inside a locked bank vault, the only way to ensure that I won't detect you is to be absolutely positive that you haven't included any bizarro bugs or constructs --- but if you can do that you don't need to collaborate in the first place!! Some people might think that if they are 100% certain that they got the program working then they are safe. This is ALSO NOT TRUE. In this particular case a couple of technically benign, but truly oddball and unnecessary constructs stood out like a very sore thumb. Subject: Assignment two grades (This message is being sent to all CPSC 215 students and TA's) I'll be sending out assignment two grades shortly. There were 24 submissions and 12 received scores of 94 or better. The average score for the 24 submissions was about 80. The test data and output images are in assns/assn2data and are named a2t?.txt/ppm Subject: Assn 3 update (This message is being sent to all CPSC 215 students and TA's) On page 65 of the notes there is an example that shows emissivity AFTER the center of the light. 10 object type light 1 3 -3 center 3 2 0 emissivity THIS IS INCORRECT. The proper order is the order used in assn3data/sphere1.txt. ---- I will also be out of town and probably out of e-mail contact most of tomorrow and all day friday. So if I seem non-responsive please don't take it personally. Subject: Midterm answer key (This message is being sent to all CPSC 215 students and TA's) The answers are in the quizzes directory in file: test1key.s05 Please try to look over it before class today. I will be glad to answer any questions you might have in class. Subject: WARNING on reading model data (This message is being sent to all CPSC 215 students and TA's) I encountered one student using the following scheme to try to "assist" fscanf() by doubling up on calls to fgets() where blank lines appeared in some sample input files. 26 fscanf(in, "%lf %lf %lf", &new_obj->specular[0], 27 &new_obj->specular[1], 28 &new_obj->specular[2]); 29 fgets(buf, 256, in); 30 fgets(buf, 256, in); You should NOT DO THIS. It has the effect of REQUIRING BLANK LINES in the data at certain locations!! fscanf() is able to consume an arbitrary number of blank lines while looking for the next data item and requires no assist of this kind. Subject: WARNING regarding unit vectors and projects (This message is being sent to all CPSC 215 students and TA's) The plane hits function is (N dot Q - N dot V) / N dot D Since N appears in all components it does not technically have to be a unit vector for the computation to work. For vl_project3() to work the normal MMMUUUSSSTTT be a unit vector. But if you (1) precompute N dot Q (as was suggested) BEFORE making N a unit vector (2) then make convert the plane normal to a unit vector before calling vl_project3() (3) and then use the precomputed N dot Q in the hits plane function along with the NOW UNITIZED normal in computing N dot V and N dot D, YOU WILL BREAK THE plane_hits function!!!!! Resolution: DON"T precompute N dot Q until the plane normal has been converted to a unit vector! Subject: CORRECTION to DBG_DIFFUSE (This message is being sent to all CPSC 215 students and TA's) The author (me), not so cleverly, failed to initialize the intensity vector in the DBG_DIFFUSE example. The correction is shown below. 1 #ifdef DBG_DIFFUSE 2 { 3 double direction[3] = {0.1, 0.1, -1.0}; -------->>> double intensity[3] = {0.0, 0.0, 0.0}; 5 vl_unitvec3(direction, direction); 6 7 fprintf(stderr, "\n\n"); 8 vl_vecprn3("ray direction is ", direction); 9 sphere_hits(view->viewpt, direction, list->head); 10 illum_diffuse(list, list->head, intensity); 11 12 exit(1); 13 } 14 #endif Thanks to Bao Ho for pointing out the error! mw Subject: Remember to INITIALIZE variables you increment (This message is being sent to all CPSC 215 students and TA's) In the example presented in class the illuminate() function ADDED the diffuse illumination to *intensity. For this approach to work correctly, it is necessary that whatever intensity points to be RESET TO 0.0 for each pixel processed. Subject: On the freeing of local variables (This message is being sent to all CPSC 215 students and TA's) I don't know if this means some of you have gotten back into the collaboration business, but here is a good reason NOT to trust every suggestion you might encounter in the lab. Apparently someone has suggested that this construct is "good", because I have now seen 4 instances of it in the last two days, and I KNOW that I didn't recommend it!! int myfunc(void); { int vec[3]; char buf[256]; --- stuff free(buf); free(vec); } This construct is not good. It is very, very, VERY bad. Please ensure that you don't have it anywhere in your program. Subject: Misleading info (a.k.a Bug ) in notes (This message is being sent to all CPSC 215 students and TA's) The current rendition of the notes has an error on page 92. As it was written, lights had to be at the end of the object list for the program to work correctly. In grading the last submission all tests had ALL LIGHTS AT THE END OF THE OBJECT LIST. So if you used the construct in the notes and your program didn't work, this was not the problem, and NO DEDUCTION WAS ASSESSED FOR ANY PROGRAM THAT CONTAINED THIS CONSTRUCT. Nevertheless, if your "find_closest_object" function is afflicted by the bug you should fix it now! Here is a correct version: ---------------------------------------------------------------- With this setup it is then possible in the raytrace module to search for the closest object in the following way: obj = lst->head; while ((obj != NULL)) { if ((obj != last_hit) && (obj->objtype != LIGHT)) { dist = obj->hits(base, dir, obj); Subject: Easy way to get Linux on your computer (This message is being sent to all CPSC 215 students and TA's) New Linux Users --------------- CLUG is having its third installfest this Saturday, April 9 from 1-5 pm in Martin Hall room M102. This will be our last installfest for the semester, so it's your last chance to get Linux with our help before Fall. All you need to bring is a computer and its cables & peripherals. You don't have to worry about backing up your data or changing your partitions before you come, we'll take care of all that Saturday. Experienced Linux Users ----------------------- If you already have Linux or have some Linux experience, please come help out. We have been short-staffed at all the other installfests this semester and it would be nice to have lots of help this time, I think good weather and decent advertising may permit us to have a pretty good turnout this time. Helping at an installfest is not hard nor does it require specific knowledge. We have prepared hand-out documentation telling users how to partition and install, plus extra sections on how to set up wireless, 3D graphics, etc. Users usually just have simple questions about the instructions, or questions about how to use Linux. Since we're recommending Ubuntu to new users, when there are problems, the fix is usually just installing a package. We also always have several people who bring RedHat, SuSE, Mandrake, Fedora, Gentoo and other Linux installs and ask us to help them fix something or help them do something better. Your knowledge is very valuable to us, no matter how little you think it is. If you can help set up, please show up at noon. Spectators ---------- We welcome visitors to our installfests, so if you'd like to come but already have Linux or aren't ready for it yet, feel free to attend anyway. Advertising & Flier ------------------- The URL for the flier is . Print and post it wherever you like. I have found that just handing them to people works pretty well, too. Subject: fplane hits warning (This message is being sent to all CPSC 215 students and TA's) At least two students have pasted these lines from page 115 of the notes directly into fplane_hits() if ((obj->hit[0] > fp->size[0]) || (obj->hit[0] < 0.0)) return(-1); if ((obj->hit[1] > fp->size[1]) || (obj->hit[1] < 0.0)) return(-1); while failing to notice the text just above which says: Suppose the base of the rectangle happened to be at (0, 0, 0), the xdir[] vector was (1,0.0) and the plane normal is (0, 0, 1). In that case, the rectangular finite plane is based at the origin and lies in the (x, y) plane. Therefore the following test (namely the above) could be applied. and the remark on page 116 which says After this is done, the simple test on the previous page may be applied to NEWHIT. So if your fplane_hits is not working correctly please ensure that this is not the cause! Subject: test data for specular lighting and tiled plane (This message is being sent to all CPSC 215 students and TA's) I've placed a couple of model descriptions and images in assn4data. These will be used by me in testing your final submission, so they provide a good place to start (but NOT STOP) testing. You are all encouraged to develop your own model descriptions for testing and if you develop one that is not a simple modification of mine, please send it to me for possible inclusion in my test set. Needless to say it helps your chances for success if I'm testing everyones code on the model you developed! Subject: Antialiasing image too dark (This message is being sent to all CPSC 215 students and TA's) On further review I think the method I suggested in class for antialiasing is sufficiently fraught with peril that I will suggest another one. (If you have the original one working correctly feel free to keep using it). Basically the problem is that if you try to ADD TO and NOT SET the intensity you have to be <<>> careful where and in what order you do things such as "scaling by 1/total_dist. If you apply that scaling to your accumulating sum you will destroy it. Hence for each component (amb, diff, specular) and for each ray you must FULLY COMPUTE THE COMPONENT in a local variable and then add it to the accumulating intensity. Unfortunately it is very easy to get this wrong. So I deserve -5 for suggesting a dangerous technique. Thus if you are having trouble in this domain I recommend going back to your antialiasing loop in mk_image() and doing something like: 38 for (m = 0; m < samples; m++) /* AA loop */ 39 { 40 double work[3]; 41 work[0] = work[1] = work[2] = 0.0; 53 : 54 ray_trace(lst, view->viewpt, dir, work, 0.0, NULL); 55 vl_sum3(intensity, work, intensity); 56 } and after you fall out of this loop divide "intensity" by samples. ------------------------------ Sorry for inducing confusion there! mw Subject: Lab exam (This message is being sent to all CPSC 215 students and TA's) There will be a CLOSED BOOK CLOSED NOTES programming exam in lab this week. The exam will consist of some simple programming problems. The ONLY library functions you will need to know how to use are printf() and scanf(). You MAY use the online man pages. Subject: texplane4 error (This message is being sent to all CPSC 215 students and TA's) The sample image associated with texplane4.txt is NOT CORRECT with respect to guidelines given in the notes. So if you got what I got, yours is broken too! Fortunately there is a one line fix. The image I produced was made using the semantics: specular reflectivity = product of the specular component of the material multiplied by the value of the texel. I later "saw the light" and decided that specular reflectivity properly should NOT depend on the color of the texel and in the notes thats how it is presented. So if you did it my old way you must have something like in your texplane_load. obj->getspec = texplane_spec; To fix the problem just delete that line. Sorry for the error there and thanks to Rob Johnson for alerting me to the potential problem. I will put a new texplane4.txt / texplane4.ppm combo out shortly. Subject: more examples / turnin directories / extra credit (This message is being sent to all CPSC 215 students and TA's) I have put some projplane examples in the assn4data directory. The one that has specular reflection is probably afflicted by the bug I reported yesterday. -------------- I have created the turn in directories -------------- Up to 10 point extra credit on THIS assignment may be obtained by submission of image description files of artistic or technical merit that your raytracer can render. Your images may also be posted by Prof. Madison in the upcoming hall of fame. If you choose to submit one, it should be named myimage.txt and placed in your turnin directory. These can be submitted until I get around to grading (probably sunday but definitely not before saturday with penalty) Artistic and technical merit are SUBJECTIVE but the judge's decision is arbitrary and final. For example, projplane7.ppm (in this judges view) demonstrates more technical capability but I think projplane8.ppm is at least as good. (You don't have to incorporate projectors (or any other specific object type) to submit. Subject: old quizzes (This message is being sent to all CPSC 215 students and TA's) All of the old quizzes are now in all.s05 in the quizzes directory. When I was giving the TA yesterday's quiz to grade, I noticed I made an undetected typo with the lpr command and printed the wrong one! So that one won't get graded. There IS a quiz N though in all.s05. Since I didn't get to use the questions yesterday, they might reappear on the makeups and/or final. Subject: Unanswered messages (This message is being sent to all CPSC 215 students and TA's) As far as I can tell I have now responded to all requests for assistance on the program. The CS215 mail input folder now has over 560 messages! Because of the volume it is entirely conceivable that I may have accidentally overlook a request. So if you sent me one in the last couple of days and you didn't receive a response, please resend it. Subject: Final exam coverage (This message is being sent to all CPSC 215 students and TA's) The final is comprehensive. There will be no C++ programming PROBLEMS but there will be C++ programming questions (similar to those on the quizzes). Subject: One LAST message (This message is being sent to all CPSC 215 students and TA's) If you recently received a message(s) from my CPSC 215 mailing list, you may have noted it was a "repeat" of a golden oldie sent last spring some time. ----------- That message had been "hanging out" in the outgoing mail queue of a system which had never been properly configured to send mail. Unfortunately, I properly configured it a week or so ago without realizing it had a big backlog which it then promptly burped up. Sorry for the inconvenience. jmw