istereo

annotate libs/vmath/geom.h @ 28:c0ae8e668447

added vmath library
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 08:30:42 +0300
parents
children ff055bff6a15
rev   line source
nuclear@28 1 #ifndef GEOM_H_
nuclear@28 2 #define GEOM_H_
nuclear@28 3
nuclear@28 4 #include "vector.h"
nuclear@28 5 #include "ray.h"
nuclear@28 6
nuclear@28 7 typedef struct {
nuclear@28 8 vec3_t norm;
nuclear@28 9 scalar_t d;
nuclear@28 10 } plane_t;
nuclear@28 11
nuclear@28 12 typedef struct {
nuclear@28 13 vec3_t pos;
nuclear@28 14 scalar_t rad;
nuclear@28 15 } sphere_t;
nuclear@28 16
nuclear@28 17 typedef struct {
nuclear@28 18 vec3_t min, max;
nuclear@28 19 } aabox_t;
nuclear@28 20
nuclear@28 21 #ifdef __cplusplus
nuclear@28 22 extern "C" {
nuclear@28 23 #endif
nuclear@28 24
nuclear@28 25 /* planes are good... you need planes, yes you do */
nuclear@28 26 plane_t plane_cons(scalar_t nx, scalar_t ny, scalar_t nz, scalar_t d);
nuclear@28 27 plane_t plane_poly(vec3_t v0, vec3_t v1, vec3_t v2);
nuclear@28 28 plane_t plane_ptnorm(vec3_t pt, vec3_t normal);
nuclear@28 29
nuclear@28 30 plane_t plane_invert(plane_t p);
nuclear@28 31
nuclear@28 32 scalar_t plane_signed_dist(plane_t plane, vec3_t pt);
nuclear@28 33 scalar_t plane_dist(plane_t plane, vec3_t pt);
nuclear@28 34 vec3_t plane_point(plane_t plane);
nuclear@28 35
nuclear@28 36 int plane_ray_intersect(ray_t ray, plane_t plane, scalar_t *pos);
nuclear@28 37
nuclear@28 38 /* spheres always come in handy */
nuclear@28 39 sphere_t sphere_cons(scalar_t x, scalar_t y, scalar_t z, scalar_t rad);
nuclear@28 40
nuclear@28 41 int sphere_ray_intersect(ray_t ray, sphere_t sph, scalar_t *pos);
nuclear@28 42 int sphere_sphere_intersect(sphere_t sph1, sphere_t sph2, scalar_t *pos, scalar_t *rad);
nuclear@28 43
nuclear@28 44 #ifdef __cplusplus
nuclear@28 45 }
nuclear@28 46
nuclear@28 47 /* TODO
nuclear@28 48 class Plane : public plane_t {
nuclear@28 49 public:
nuclear@28 50 };
nuclear@28 51 */
nuclear@28 52
nuclear@28 53 #endif
nuclear@28 54
nuclear@28 55 #endif /* GEOM_H_ */