I was reading Hacker News and this article came up. It contains a raytracer that the code is written on the back of a business card. I decided it would be a good academic challenge to translate the c++ to python, but there's a few concepts I'm stuck on.
First, this function comes up: i T(v o,v d,f& t,v& n){...}
Which is translated to int Tracer(vector o, vector d, float& t, vector& n){...}
What does the float&
mean? I know that in other places &
is used as a ==
is that the case here? Can you do that in c++?
Second, I noticed these three lines:
for(i k=19;k--;) //For each columns of objects
for(i j=9;j--;) //For each line on that columns
if(G[j]&1<<k){
I know the <<
is a the bit shift, and I assume the &
is ==
. Are the for loops just like one for loop in an other?
Finally, this line: v p(13,13,13);
I am not quite sure what it does. Does it create a class labeled by p that extends v (vector) with the defaults of 13,13,13?
These are probably dumb questions, but I want to see if I can understand this and my searching didn't come up with anything. Thank you in advance!