Revision 1175
Hopefully unbroke simulator with circles
world.c | ||
---|---|---|
54 | 54 |
|
55 | 55 |
double collide_circle(ray_t *ray, object_t *obj) |
56 | 56 |
{ |
57 |
/*double Or, Vr_x, Vr_y;
|
|
58 |
point_t Oc; |
|
57 |
point_t Or, Oc, Vr;
|
|
58 |
|
|
59 | 59 |
|
60 |
Or = ray->p; |
|
61 |
Oc = ((circle_t*)(obj->props))->center; |
|
62 |
Vr = ray->d; |
|
60 |
point_t Or = ray->p;
|
|
61 |
point_t Oc = ((circle_t*)(obj->props))->center;
|
|
62 |
point_t Vr = ray->d;
|
|
63 | 63 |
point_t Vr = {ray->p.x+cos(ray->d),ray->p.y+sin(ray->d)}; |
64 | 64 |
|
65 | 65 |
|
... | ... | |
73 | 73 |
return -((2*Vr.x*(Or.x - Oc.x))^2 - 4*Vr.x*(Or.x - Oc.x)^2) / (2*Vr.x)); |
74 | 74 |
} |
75 | 75 |
|
76 |
*/ |
|
76 |
|
|
77 | 77 |
return -1; |
78 | 78 |
} |
79 | 79 |
|
Also available in: Unified diff