Stream: Google Code-in

Topic: AppleSeed#2


view this post on Zulip Mitesh (Jan 04 2018 at 13:16):

What does the drawing out PPM in this task means?

view this post on Zulip Jeff Sieu (Jan 04 2018 at 14:45):

It means drawing an output image in the PPM format.

view this post on Zulip Jeff Sieu (Jan 04 2018 at 14:46):

https://www.wikiwand.com/en/Netpbm_format

view this post on Zulip Mitesh (Jan 04 2018 at 15:26):

okk got that

view this post on Zulip Mitesh (Jan 04 2018 at 15:28):

I mean the task says that it should be black and white surrounded by misses(black). I successfully build this

http://brlcad.org/wiki/Example_Application

So am i suppose to program it in such a way that rays passes through the sphere and shows that...

view this post on Zulip Lucas Prieels (Jan 04 2018 at 15:37):

I mean the task says that it should be black and white surrounded by misses(black). I successfully build this

http://brlcad.org/wiki/Example_Application

So am i suppose to program it in such a way that rays passes through the sphere and shows that...

You have to somehow draw a black pixel if you hit and a white one if you miss

view this post on Zulip Mitesh (Jan 04 2018 at 15:40):

okk...thank you so much

view this post on Zulip Lucas Prieels (Jan 04 2018 at 15:49):

okk...thank you so much

Good luck! I didn’t know the ppm images before but it is very useful and extremely simple to use!

view this post on Zulip Sean (Jan 04 2018 at 17:29):

they're a great debugging format since they're a simple text header followed by binary image data just like it's held in memory

view this post on Zulip Mitesh (Jan 06 2018 at 16:55):

i am wondering how to shoot rays horizontaly....for vertically what i thought was to use for loop and add cout<<endl; once the function is executed...Am i going in right direction?

view this post on Zulip Lucas Prieels (Jan 07 2018 at 01:00):

i am wondering how to shoot rays horizontaly....for vertically what i thought was to use for loop and add cout<<endl; once the function is executed...Am i going in right direction?

You only have to shoot a grid of rays in 2D. Imagine it like this: take a sphere, hold it in front of you and light it up with a flashlight, the shadow on the wall will be a circle. That's exactly what you need to do: given a sphere, light it up by shooting rays (like light rays) and output the circle, the shadow on the wall. I don't want to give a too big clue, but you'll need a couple of loops to do it.

view this post on Zulip Mitesh (Jan 09 2018 at 08:06):

what does this function VSET(ap.a_ray.r_dir, 0.0, 0.0, -1.0) do?

view this post on Zulip Jeff Sieu (Jan 09 2018 at 08:45):

Set the ray direction of ap.a_ray to 0.0, 0.0, -1.0

view this post on Zulip Mitesh (Jan 09 2018 at 09:13):

okk

view this post on Zulip Mitesh (Jan 09 2018 at 10:31):

is it ok if write out the image in .pgm format?

view this post on Zulip Jeff Sieu (Jan 09 2018 at 10:40):

I suppose any image format is fine as long as you can see the image.

view this post on Zulip Mitesh (Jan 09 2018 at 10:41):

ok

view this post on Zulip Mitesh (Jan 09 2018 at 11:56):

i am getting circular file but not circular image...cicle.PNG

view this post on Zulip Mitesh (Jan 09 2018 at 11:58):

any ideas?

view this post on Zulip Jeff Sieu (Jan 09 2018 at 16:11):

Read up on how the format works

view this post on Zulip Mitesh (Jan 09 2018 at 16:30):

okk

view this post on Zulip Mitesh (Jan 09 2018 at 16:52):

anyone completed this task?

view this post on Zulip Mitesh (Jan 09 2018 at 17:00):

The usage seems to be correct @Jeff Sieu ....usage.PNG

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:01):

Did you put the P2 in your file

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:01):

And the width and height of the image on the next line

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:02):

Or P<whatever>*

view this post on Zulip Mitesh (Jan 09 2018 at 17:02):

yes..I did

view this post on Zulip Lucas Prieels (Jan 09 2018 at 17:03):

I'm not sure you can put comments in a PPM file, try to erase it

view this post on Zulip Lucas Prieels (Jan 09 2018 at 17:12):

Ah I had not seen that the second one was working, but since it writes an image I suppose that's your code which is wrong... Maybe it doesn't print a black pixel when it should

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:12):

You may be printing too many per line

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:13):

Is the number of numbers per line = width

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:13):

Can you send over the whole file's contents

view this post on Zulip Lucas Prieels (Jan 09 2018 at 17:13):

@Mitesh Can you send the whole file?

view this post on Zulip Lucas Prieels (Jan 09 2018 at 17:14):

Oups didn't see you just asked :)

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:16):

I think I know the problem here

view this post on Zulip Lucas Prieels (Jan 09 2018 at 17:16):

Also, are you sure you put three numbers for each pixel? I see that in the last line, there are 7 times the number 15

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:17):

The number of columns may be smaller than the specified width

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:18):

Causing the image to look like a sort of "staircase", as some of the pixels from the second row are treated as that of the first

view this post on Zulip Jeff Sieu (Jan 09 2018 at 17:18):

Just my guess though

view this post on Zulip Mitesh (Jan 09 2018 at 17:43):

sorry my computer has shutdown... there is some power problem and i don't have that file in my laptop....i will send the file tom asap....Thank you so much

view this post on Zulip Mitesh (Jan 09 2018 at 18:02):

wait it has started... i will send in few moments

view this post on Zulip Mitesh (Jan 09 2018 at 18:03):

color.pgm

view this post on Zulip Mitesh (Jan 09 2018 at 18:04):

here is the file @Jeff Sieu , @Lucas Prieels

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:07):

I've already seen that there are approximately 61-62 numbers per line and 61 lines, so I think there should be more numbers (I'm not certain because it's not easy to count them :)

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:07):

But there's definitely a problem with number of 15, it should be a multiple of 3 on each line, and it's not

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:12):

Forget what I said, I didn't see it was a .pgm file, I used a .ppm one

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:29):

I found out: re-check you have the right numbers of rows and columns :)

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:35):

But otherwise, you effectively have a sphere. Just a thing, I don't know if it's important for the task but you should take a bigger resolution and fire more rays

view this post on Zulip Lucas Prieels (Jan 09 2018 at 19:35):

One last thing: try not to place double spaces. Don't know if it can change anything for the .pgm files, but it makes it difficult to read

view this post on Zulip Mitesh (Jan 10 2018 at 05:39):

okk...Thank you so much

view this post on Zulip Mitesh (Jan 10 2018 at 08:36):

Bingo...appleseed task#2 done..thank you so much guys

view this post on Zulip Mitesh (Jan 11 2018 at 06:19):

I think i got a bug... Yesterday when i tried to include header files without .h (like #include "iostream" )suddenly i got errors around 3000

view this post on Zulip Mitesh (Jan 11 2018 at 06:20):

errorh.PNG

view this post on Zulip Mitesh (Jan 11 2018 at 06:22):

errorh2.PNG

view this post on Zulip Mitesh (Jan 12 2018 at 01:19):

Ok....its not a bug...i just used wrong header files....

view this post on Zulip Sean (Jan 12 2018 at 16:54):

and the wrong include pattern -- it should have been #include <iostream>

view this post on Zulip Sean (Jan 12 2018 at 16:54):

"" is for local headers, <> is for system headers


Last updated: Oct 09 2024 at 00:44 UTC