source: trunk/src/lol/math/geometry.h @ 2354

Last change on this file since 2354 was 2354, checked in by sam, 7 years ago

base: move headers around and promote gpu/ to lol/gpu/.

File size: 1.9 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
5//            (c) 2010-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
6//   This program is free software; you can redistribute it and/or
7//   modify it under the terms of the Do What The Fuck You Want To
8//   Public License, Version 2, as published by Sam Hocevar. See
9//   http://www.wtfpl.net/ for more details.
10//
11
12//
13// Various geometry functions
14// --------------------------
15//
16
17#if !defined __LOL_MATH_GEOMETRY_H__
18#define __LOL_MATH_GEOMETRY_H__
19
20#include <cmath>
21#include <cstdio>
22#include <algorithm>
23
24#include <stdint.h>
25
26#define CSG_EPSILON     0.0001
27
28namespace lol
29{
30    bool TriangleIsectTriangle(vec3 const &v00, vec3 const &v01, vec3 const &v02,
31                               vec3 const &v10, vec3 const &v11, vec3 const &v12,
32                               vec3 &iP00, vec3 &iP10);
33    bool RayIsectTriangleSide(vec3 const &v0, vec3 const &v1, vec3 const &v2,
34                              vec3 const &iP0, vec3 const &iP1,
35                              vec3 &iV0, int &iIdx0, vec3 &iV1, int &iIdx1);
36    bool RayIsectTriangle(vec3 const &rayP, vec3 const &rayD,
37                          vec3 const &triV0, vec3 const &triV1, vec3 const &triV2,
38                          vec3 &vi);
39#define RAY_ISECT_NOTHING   0
40#define RAY_ISECT_ALL       1
41#define RAY_ISECT_NONE      2
42#define RAY_ISECT_P0        3
43#define RAY_ISECT_P1        4
44    int RayIsectRay(vec3 const &rayP00, vec3 const &rayP01,
45                    vec3 const &rayP10, vec3 const &rayP11,
46                    vec3 &vIsec);
47    vec3 ProjPointOnPlane(vec3 const &point, vec3 const &planeP, vec3 const &planeN);
48    bool RayIsectPlane(vec3 const &rayP0, vec3 const &rayP1,
49                       vec3 const &planeP, vec3 const &planeN,
50                       vec3 &vIsec, bool test_line_only = false);
51
52} /* namespace lol */
53
54#endif // __LOL_MATH_GEOMETRY_H__
55
Note: See TracBrowser for help on using the repository browser.