raytracing - Ray-tracer loop ordering -


Tracer and found an unexpected problem. If I write the two main ends of the re-tracer, the people responsible for the image pixel, like this:

 for  (int y = 0; y & lt; image.getWidth (); Y ++) {For (int x = 0; x & lt; image.getHyight (); x ++) { 

I get this distorted image (actually , The image of Facebook scoops, in any way, is more than the actual, but the issue is that the code has many reflective areas with many types of scanlines (which are actually small)

However, if I make a small change, then:

 for  (int y = 0; y & lt ; Image.getHyight (); y ++) {for (int x = 0; X & lt; image.getWidth (); x ++) {  

As an attraction Works as it can be seen below:

getHyight , getWidth gives me the height and width of the image Here's some more code that I believe can be helpful:

  rayview = {{float (x), float (y), -1000.0 f}, {0.0 f , 0.0 F, 1.0 F}}  

La Part camera location, the other thing is that I do not know why it makes any input is appreciated. If another code is necessary to evaluate the problem, just ask.

The problem is that although you change the order of the for-loop, you are not changing the index . You should try:

 for  (int x = 0; x & lt; image.getWidth (); x ++) {for (int y = 0; y & lt; image .getHyight (); y ++) { 

Compare two snippets with that post.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -