goat3d

annotate libs/vmath/geom.h @ 29:3d669155709d

- switched the unix build to use the internal vmath/anim as well - fixed a memory corruption issue which was caused by including the system-wide installed version of the anim.h header file - started the ass2goat assimp->goat3d converter
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 29 Sep 2013 21:53:03 +0300
parents
children
rev   line source
nuclear@27 1 /*
nuclear@27 2 libvmath - a vector math library
nuclear@27 3 Copyright (C) 2004-2012 John Tsiombikas <nuclear@member.fsf.org>
nuclear@27 4
nuclear@27 5 This program is free software: you can redistribute it and/or modify
nuclear@27 6 it under the terms of the GNU Lesser General Public License as published
nuclear@27 7 by the Free Software Foundation, either version 3 of the License, or
nuclear@27 8 (at your option) any later version.
nuclear@27 9
nuclear@27 10 This program is distributed in the hope that it will be useful,
nuclear@27 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@27 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@27 13 GNU Lesser General Public License for more details.
nuclear@27 14
nuclear@27 15 You should have received a copy of the GNU Lesser General Public License
nuclear@27 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@27 17 */
nuclear@27 18 #ifndef LIBVMATH_GEOM_H_
nuclear@27 19 #define LIBVMATH_GEOM_H_
nuclear@27 20
nuclear@27 21 #include "vector.h"
nuclear@27 22 #include "ray.h"
nuclear@27 23
nuclear@27 24 typedef struct {
nuclear@27 25 vec3_t norm;
nuclear@27 26 scalar_t d;
nuclear@27 27 } plane_t;
nuclear@27 28
nuclear@27 29 typedef struct {
nuclear@27 30 vec3_t pos;
nuclear@27 31 scalar_t rad;
nuclear@27 32 } sphere_t;
nuclear@27 33
nuclear@27 34 typedef struct {
nuclear@27 35 vec3_t min, max;
nuclear@27 36 } aabox_t;
nuclear@27 37
nuclear@27 38 #ifdef __cplusplus
nuclear@27 39 extern "C" {
nuclear@27 40 #endif
nuclear@27 41
nuclear@27 42 /* planes are good... you need planes, yes you do */
nuclear@27 43 plane_t plane_cons(scalar_t nx, scalar_t ny, scalar_t nz, scalar_t d);
nuclear@27 44 plane_t plane_poly(vec3_t v0, vec3_t v1, vec3_t v2);
nuclear@27 45 plane_t plane_ptnorm(vec3_t pt, vec3_t normal);
nuclear@27 46
nuclear@27 47 plane_t plane_invert(plane_t p);
nuclear@27 48
nuclear@27 49 scalar_t plane_signed_dist(plane_t plane, vec3_t pt);
nuclear@27 50 scalar_t plane_dist(plane_t plane, vec3_t pt);
nuclear@27 51 vec3_t plane_point(plane_t plane);
nuclear@27 52
nuclear@27 53 int plane_ray_intersect(ray_t ray, plane_t plane, scalar_t *pos);
nuclear@27 54
nuclear@27 55 /* spheres always come in handy */
nuclear@27 56 sphere_t sphere_cons(scalar_t x, scalar_t y, scalar_t z, scalar_t rad);
nuclear@27 57
nuclear@27 58 int sphere_ray_intersect(ray_t ray, sphere_t sph, scalar_t *pos);
nuclear@27 59 int sphere_sphere_intersect(sphere_t sph1, sphere_t sph2, scalar_t *pos, scalar_t *rad);
nuclear@27 60
nuclear@27 61 #ifdef __cplusplus
nuclear@27 62 }
nuclear@27 63
nuclear@27 64 /* TODO
nuclear@27 65 class Plane : public plane_t {
nuclear@27 66 public:
nuclear@27 67 };
nuclear@27 68 */
nuclear@27 69
nuclear@27 70 #endif
nuclear@27 71
nuclear@27 72 #endif /* LIBVMATH_GEOM_H_ */