istereo

view libs/vmath/geom.h @ 35:23e5d274b2a2

added options panel, also added the xib files to the repository as they're needed
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 09 Sep 2011 10:03:42 +0300
parents
children ff055bff6a15
line source
1 #ifndef GEOM_H_
2 #define GEOM_H_
4 #include "vector.h"
5 #include "ray.h"
7 typedef struct {
8 vec3_t norm;
9 scalar_t d;
10 } plane_t;
12 typedef struct {
13 vec3_t pos;
14 scalar_t rad;
15 } sphere_t;
17 typedef struct {
18 vec3_t min, max;
19 } aabox_t;
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 /* planes are good... you need planes, yes you do */
26 plane_t plane_cons(scalar_t nx, scalar_t ny, scalar_t nz, scalar_t d);
27 plane_t plane_poly(vec3_t v0, vec3_t v1, vec3_t v2);
28 plane_t plane_ptnorm(vec3_t pt, vec3_t normal);
30 plane_t plane_invert(plane_t p);
32 scalar_t plane_signed_dist(plane_t plane, vec3_t pt);
33 scalar_t plane_dist(plane_t plane, vec3_t pt);
34 vec3_t plane_point(plane_t plane);
36 int plane_ray_intersect(ray_t ray, plane_t plane, scalar_t *pos);
38 /* spheres always come in handy */
39 sphere_t sphere_cons(scalar_t x, scalar_t y, scalar_t z, scalar_t rad);
41 int sphere_ray_intersect(ray_t ray, sphere_t sph, scalar_t *pos);
42 int sphere_sphere_intersect(sphere_t sph1, sphere_t sph2, scalar_t *pos, scalar_t *rad);
44 #ifdef __cplusplus
45 }
47 /* TODO
48 class Plane : public plane_t {
49 public:
50 };
51 */
53 #endif
55 #endif /* GEOM_H_ */