![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| What do you mean by less than 30? If the VALUE is less than 30...no. It's the DISTANCE that you're looking for. Amanda Bennett |
| if you know everything on the prequiz, you should be fine for the quiz. Amanda Bennett |
| The distance is the square root of 128^2 plus 1^2, which is actually the square root of 16385. Don't forget what the formula is! Amanda Bennett |
| Should be SQRT(1^2 + 127^2) Amanda Bennett |
| Don't forget there is 0 as a value for a color. So, you have the range [0,255] for color values, which means you manipulate things by 256. Amanda Bennett |
| This is answered below. Check it out Amanda Bennett |
| Yes. |
| Moved to Thursday |
| Click this link TA-Student Pairings - Albert d'Heurle |
| Close, but no. Liz Helms |
| also close, but not quite. check out you last value... Amanda Bennett |
| No, you need to get the distance between the colors in the box and (0,0,128) to see if you need to change the colors. Amanda Bennett |
| Yes recitation is optional. You might want to go to one on thrusday just to see what it is like. -Albert d'Heurle |
| I second Albert's suggestion. You might benefit from going to another recitation this week in particular, because the mechanics of downloading JES, using WebWork, etc. are being covered. You need to be comfortable with all of these skills, because you will be using them for all the labs and assignments. – Colin Potts |
| Yes, it is. -Blake O'Hare |
| Hey, everyone. I explained in class that weird things happen if you try to set a color value outside the range 0..255, but only hinted what happened. The pre-quiz (and maybe the quiz ... hint, hint ...) requires you to state what happens more exactly. Here's the scoop: It's just like two-digit dates or clocks. Once you get to the maximum, the numbers just wrap around. So just as there was no year 100 after year 99 in the Y2k situation, and just as there is no 13 o'clock on 12-hour clock faces, there is no color intensity value of 256. As with the year (year 00), hours (1 o'clock), so with colors. If you add one to 255, you get zero, not 256. This is explained in pp. 61-62 of the book. Colin Potts |
| yes. Liz Helms |
| (0,0,128) | (2,0,128) | (1,0,255) |
| (4,2,128) | (20,10,120) | (128,128,128) |
| Indeed. Charlie is a silly head! -Blake O'Hare |
| No. If the blues were to change, that would require a setBlue or setColor in the code, which there is not. Also, double check your distance formula. -Blake O'Hare |
| Yes. -Blake O'Hare |
| It isn't. Make sure you know what the distance function and if statement are really doing. This will be covered a little more on Tuesday. -Blake O'Hare |
| Your because clause is correct. Your numbers are not. The best way to think about the wrap-around problem with color values is to add 256, then divide everything by 256 and the remainder is the correct value. -Blake O'Hare |
| No. Read the other questions people ask, and their answers, and sometimes, you wont even have to ask your question. Liz Helms |
| Think about how an if statement works and what it is used for. Larry Olson |
| The meaning of each color component, ( red , green, blue ), in a pixel is the amount of that color present in the pixel. Hence, black, (0,0,0) is the absence of all colors and white (255, 255, 255) is the complete presence of all color. Think of a few other colors, perhaps purple which is a mixture of red and blue in various amounts. A shade of purple could be something like (128, 0 , 100). Hope this helps.Larry Olson |
| Also take a look at the question itself, it kind of hints at the correct answer. Larry Olson |
| First things first. The answers that your classmates post on this page may or may not be correct. In general if they are incorrect we will say something. However, if they are correct, we might not make a sound. So dont take all of the answers on this page as the be all end all. Instead, trust your own instincts (note: in the way you posed the question it looks like you DO have a good idea, you ARE on the right track). That being said, consider each part of the program individually. First are variables which are just holding values. For instance, lightBlue is holding the color with rgb values ( 0 , 0 , 128). The next thing to notice is the for loop. Think about what a for loop does. It repeats a section of code over and over again. Finally, think of what an if statement does. It allows you to make a choice. Basically, if "something" is true then do "this". In this case we are checking to see if the color value of a pixel is within a certain distance of another color, specifically light blue. How do we do distance? Well that is nothing more than the forula SQRT( (Red0 - Red1)^2 + (Green0 - Green1)^2 + (Blue0 - Blue1)^2) (NOTE: See page 49 in the book). Pull out a calculator and plug in some numbers a few times. Larry Olson |