Revision 1045
added a sample world, updated main to load the sample world
world.c  

61  61 
point_t p1 = ray>p; 
62  62 
point_t p2 = {ray>p.x+cos(ray>d),ray>p.y+sin(ray>d)}; 
63  63  
64 
#if DEBUG 

65 
printf("(%g,%g) > (%g,%g) with (%g,%g) > (%g,%g)\n",p1.x,p1.y,p2.x,p2.y,p3.x,p3.y,p4.x,p4.y); 

66 
#endif 

64 
//printf("(%g,%g) > (%g,%g) with (%g,%g) > (%g,%g)\n",p1.x,p1.y,p2.x,p2.y,p3.x,p3.y,p4.x,p4.y); 

67  65 
denom = (p2.yp1.y)*(p4.xp3.x)(p2.xp1.x)*(p4.yp3.y); 
68  66 
if (denom == 0) { 
69  67 
return RAY_MISS; 
...  ...  
84  82 
xint = p3.x+ua*(p4.xp3.x); 
85  83 
yint = p3.y+ua*(p4.yp3.y); 
86  84 
dist = sqrt((xintp1.x)*(xintp1.x)+(yintp1.y)*(yintp1.y)); 
87 
#if DEBUG 

88 
printf("Got: %g\n", dist); 

89 
#endif 

90  85 
return dist; 
91  86  
92  87 
} 
Also available in: Unified diff