From c67f7a14a1dd010d4315aafd1b744442aa02ed03 Mon Sep 17 00:00:00 2001 From: Uwila Date: Mon, 30 Mar 2020 23:44:00 +0200 Subject: [PATCH 01/11] Add ray-triangle intersection check --- Makefile.am | 9 ++++-- docs/source/api.rst | 1 + docs/source/ray.rst | 31 +++++++++++++++++++ include/cglm/call.h | 1 + include/cglm/call/ray.h | 22 ++++++++++++++ include/cglm/cglm.h | 1 + include/cglm/ray.h | 66 ++++++++++++++++++++++++++++++++++++++++ src/ray.c | 8 +++++ win/cglm.vcxproj | 3 ++ win/cglm.vcxproj.filters | 9 ++++++ 10 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 docs/source/ray.rst create mode 100644 include/cglm/call/ray.h create mode 100644 include/cglm/ray.h create mode 100644 src/ray.c diff --git a/Makefile.am b/Makefile.am index 46b90b5..f6b4a21 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,7 +63,8 @@ cglm_HEADERS = include/cglm/version.h \ include/cglm/ease.h \ include/cglm/curve.h \ include/cglm/bezier.h \ - include/cglm/applesimd.h + include/cglm/applesimd.h \ + include/cglm/ray.h cglm_calldir=$(includedir)/cglm/call cglm_call_HEADERS = include/cglm/call/mat4.h \ @@ -84,7 +85,8 @@ cglm_call_HEADERS = include/cglm/call/mat4.h \ include/cglm/call/sphere.h \ include/cglm/call/ease.h \ include/cglm/call/curve.h \ - include/cglm/call/bezier.h + include/cglm/call/bezier.h \ + include/cglm/call/ray.h cglm_simddir=$(includedir)/cglm/simd cglm_simd_HEADERS = include/cglm/simd/intrin.h \ @@ -147,7 +149,8 @@ libcglm_la_SOURCES=\ src/sphere.c \ src/ease.c \ src/curve.c \ - src/bezier.c + src/bezier.c \ + src/ray.c test_tests_SOURCES=\ test/runner.c \ diff --git a/docs/source/api.rst b/docs/source/api.rst index b157716..717b61c 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -52,3 +52,4 @@ Follow the :doc:`build` documentation for this curve bezier version + ray diff --git a/docs/source/ray.rst b/docs/source/ray.rst new file mode 100644 index 0000000..c5faf33 --- /dev/null +++ b/docs/source/ray.rst @@ -0,0 +1,31 @@ +.. default-domain:: C + +ray +==== + +Header: cglm/ray.h + +This is for collision-checks used by ray-tracers and the like. + +Table of contents (click to go): +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Functions: + +1. :c:func:`glm_ray_triangle` + +Functions documentation +~~~~~~~~~~~~~~~~~~~~~~~ + +.. c:function:: bool glm_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) + + Möller–Trumbore ray-triangle intersection algorithm + + Parameters: + | *[in]* **origin** origin of ray + | *[in]* **direction** direction of ray + | *[in]* **v0** first vertex of triangle + | *[in]* **v1** second vertex of triangle + | *[in]* **v2** third vertex of triangle + | *[in, out]* **d** float pointer to save distance to intersection + | *[out]* **intersection** whether there is intersection diff --git a/include/cglm/call.h b/include/cglm/call.h index 87ecea5..b51b731 100644 --- a/include/cglm/call.h +++ b/include/cglm/call.h @@ -31,6 +31,7 @@ extern "C" { #include "call/ease.h" #include "call/curve.h" #include "call/bezier.h" +#include "call/ray.h" #ifdef __cplusplus } diff --git a/include/cglm/call/ray.h b/include/cglm/call/ray.h new file mode 100644 index 0000000..0bfefe0 --- /dev/null +++ b/include/cglm/call/ray.h @@ -0,0 +1,22 @@ +/* + * Copyright (c), Recep Aslantas. + * + * MIT License (MIT), http://opensource.org/licenses/MIT + * Full license can be found in the LICENSE file + */ + +#ifndef cglmc_ray_h +#define cglmc_ray_h +#ifdef __cplusplus +extern "C" { +#endif +#include "../cglm.h" + +CGLM_EXPORT +bool +glmc_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d); + +#ifdef __cplusplus +} +#endif +#endif /* cglmc_ray_h */ diff --git a/include/cglm/cglm.h b/include/cglm/cglm.h index cbd2952..afc7f99 100644 --- a/include/cglm/cglm.h +++ b/include/cglm/cglm.h @@ -30,5 +30,6 @@ #include "ease.h" #include "curve.h" #include "bezier.h" +#include "ray.h" #endif /* cglm_h */ diff --git a/include/cglm/ray.h b/include/cglm/ray.h new file mode 100644 index 0000000..c2433cb --- /dev/null +++ b/include/cglm/ray.h @@ -0,0 +1,66 @@ +/* + * Copyright (c), Recep Aslantas. + * + * MIT License (MIT), http://opensource.org/licenses/MIT + * Full license can be found in the LICENSE file + */ + +/* + Functions: + CGLM_INLINE bool glm_line_triangle_intersect(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d); +*/ + +#ifndef cglm_ray_h +#define cglm_ray_h + +#include "vec3.h" + +/*! + * @brief Möller–Trumbore ray-triangle intersection algorithm + * + * @param[in] origin origin of ray + * @param[in] direction direction of ray + * @param[in] v0 first vertex of triangle + * @param[in] v1 second vertex of triangle + * @param[in] v2 third vertex of triangle + * @param[in, out] d distance to intersection + * @param[out] intersection whether there is intersection + */ + +CGLM_INLINE +bool +glm_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) { + const float epsilon = 0.000001; + vec3 edge1, edge2, p, t, q; + float det, inv_det, u, v; + + glm_vec3_sub(v1, v0, edge1); + glm_vec3_sub(v2, v0, edge2); + + glm_vec3_cross(direction, edge2, p); + + det = glm_vec3_dot(edge1, p); + + if (det > -epsilon && det < epsilon) + return 0; + inv_det = 1.0 / det; + + glm_vec3_sub(origin, v0, t); + + u = inv_det * glm_vec3_dot(t, p); + + if (u < 0.0 || u > 1.0) + return 0; + + glm_vec3_cross(t, edge1, q); + + v = inv_det * glm_vec3_dot(direction, q); + + if (v < 0.0 || u + v > 1.0) + return 0; + + *d = inv_det * glm_vec3_dot(edge2, q); + return *d > epsilon; +} + +#endif diff --git a/src/ray.c b/src/ray.c new file mode 100644 index 0000000..4ce0c58 --- /dev/null +++ b/src/ray.c @@ -0,0 +1,8 @@ +#include "../include/cglm/cglm.h" +#include "../include/cglm/call.h" + +CGLM_EXPORT +bool +glmc_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) { + return glm_ray_triangle(origin, direction, v0, v1, v2, d); +} diff --git a/win/cglm.vcxproj b/win/cglm.vcxproj index e1a0e4d..a95f21e 100644 --- a/win/cglm.vcxproj +++ b/win/cglm.vcxproj @@ -34,6 +34,7 @@ + @@ -61,6 +62,7 @@ + @@ -80,6 +82,7 @@ + diff --git a/win/cglm.vcxproj.filters b/win/cglm.vcxproj.filters index a2f1432..fe23bd6 100644 --- a/win/cglm.vcxproj.filters +++ b/win/cglm.vcxproj.filters @@ -92,6 +92,9 @@ src + + src + @@ -124,6 +127,9 @@ include\cglm\call + + include\cglm\call + include\cglm\simd\avx @@ -241,6 +247,9 @@ include\cglm + + include\cglm + include\cglm\simd From 99076be6bb8c8d3e5d2bb44835ed252f4a832091 Mon Sep 17 00:00:00 2001 From: Uwila Date: Fri, 3 Apr 2020 12:56:50 +0200 Subject: [PATCH 02/11] Improve code style in ray.h - 2 spaces instead of 4, for indentation - Newline after return - Check if pointer is null --- include/cglm/ray.h | 49 +++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/include/cglm/ray.h b/include/cglm/ray.h index c2433cb..eac5140 100644 --- a/include/cglm/ray.h +++ b/include/cglm/ray.h @@ -30,37 +30,46 @@ CGLM_INLINE bool glm_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) { - const float epsilon = 0.000001; - vec3 edge1, edge2, p, t, q; - float det, inv_det, u, v; + vec3 edge1, edge2, p, t, q; + float det, inv_det, u, v, dist; + const float epsilon = 0.000001; - glm_vec3_sub(v1, v0, edge1); - glm_vec3_sub(v2, v0, edge2); + glm_vec3_sub(v1, v0, edge1); + glm_vec3_sub(v2, v0, edge2); - glm_vec3_cross(direction, edge2, p); + glm_vec3_cross(direction, edge2, p); - det = glm_vec3_dot(edge1, p); + det = glm_vec3_dot(edge1, p); - if (det > -epsilon && det < epsilon) - return 0; - inv_det = 1.0 / det; + if (det > -epsilon && det < epsilon) + return 0; - glm_vec3_sub(origin, v0, t); + inv_det = 1.0 / det; - u = inv_det * glm_vec3_dot(t, p); + glm_vec3_sub(origin, v0, t); - if (u < 0.0 || u > 1.0) - return 0; + u = inv_det * glm_vec3_dot(t, p); - glm_vec3_cross(t, edge1, q); + if (u < 0.0 || u > 1.0) + return 0; - v = inv_det * glm_vec3_dot(direction, q); + glm_vec3_cross(t, edge1, q); - if (v < 0.0 || u + v > 1.0) - return 0; + v = inv_det * glm_vec3_dot(direction, q); - *d = inv_det * glm_vec3_dot(edge2, q); - return *d > epsilon; + if (v < 0.0 || u + v > 1.0) + return 0; + + dist = inv_det * glm_vec3_dot(edge2, q); + if (dist > epsilon) { + if (d != NULL) { + *d = dist; + } + + return 1; + } + + return 0; } #endif From 7bf38a3062540f80369c593e1e7647627055e06a Mon Sep 17 00:00:00 2001 From: Uwila Date: Fri, 3 Apr 2020 13:10:38 +0200 Subject: [PATCH 03/11] Update credits with ray-triangle intersection algorithm --- CREDITS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CREDITS b/CREDITS index a159edf..ef9b2e4 100644 --- a/CREDITS +++ b/CREDITS @@ -65,3 +65,9 @@ https://forums.khronos.org/showthread.php/10651-Animation-TCB-Spline-Interpolati 12. vec2 cross product http://allenchou.net/2013/07/cross-product-of-2d-vectors/ +13. Ray triangle intersect +Möller–Trumbore ray-triangle intersection algorithm, from "Fast, Minimum Storage Ray/Triangle Intersection" +Authors: + Thomas Möller (tompa@clarus.se) + Ben Trumbore (wbt@graphics.cornell.edu) +Link to paper: http://webserver2.tecgraf.puc-rio.br/~mgattass/cg/trbRR/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf \ No newline at end of file From 339adab783b8470f137f03b4ea0465986374e7a9 Mon Sep 17 00:00:00 2001 From: Uwila Date: Fri, 3 Apr 2020 17:56:53 +0200 Subject: [PATCH 04/11] Align variables in ray code --- include/cglm/call/ray.h | 7 ++++++- include/cglm/ray.h | 14 ++++++++++++-- src/ray.c | 7 ++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/include/cglm/call/ray.h b/include/cglm/call/ray.h index 0bfefe0..1fff055 100644 --- a/include/cglm/call/ray.h +++ b/include/cglm/call/ray.h @@ -14,7 +14,12 @@ extern "C" { CGLM_EXPORT bool -glmc_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d); +glmc_ray_triangle(vec3 origin, + vec3 direction, + vec3 v0, + vec3 v1, + vec3 v2, + float *d); #ifdef __cplusplus } diff --git a/include/cglm/ray.h b/include/cglm/ray.h index eac5140..ec434a1 100644 --- a/include/cglm/ray.h +++ b/include/cglm/ray.h @@ -7,7 +7,12 @@ /* Functions: - CGLM_INLINE bool glm_line_triangle_intersect(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d); + CGLM_INLINE bool glm_line_triangle_intersect(vec3 origin, + vec3 direction, + vec3 v0, + vec3 v1, + vec3 v2, + float *d); */ #ifndef cglm_ray_h @@ -29,7 +34,12 @@ CGLM_INLINE bool -glm_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) { +glm_ray_triangle(vec3 origin, + vec3 direction, + vec3 v0, + vec3 v1, + vec3 v2, + float *d) { vec3 edge1, edge2, p, t, q; float det, inv_det, u, v, dist; const float epsilon = 0.000001; diff --git a/src/ray.c b/src/ray.c index 4ce0c58..973c059 100644 --- a/src/ray.c +++ b/src/ray.c @@ -3,6 +3,11 @@ CGLM_EXPORT bool -glmc_ray_triangle(vec3 origin, vec3 direction, vec3 v0, vec3 v1, vec3 v2, float *d) { +glmc_ray_triangle(vec3 origin, + vec3 direction, + vec3 v0, + vec3 v1, + vec3 v2, + float *d) { return glm_ray_triangle(origin, direction, v0, v1, v2, d); } From c1331a1dd4911f950bbfa8a4259e6a1e07b0704f Mon Sep 17 00:00:00 2001 From: Uwila Date: Fri, 3 Apr 2020 18:00:49 +0200 Subject: [PATCH 05/11] Improve ray.h style --- include/cglm/ray.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/include/cglm/ray.h b/include/cglm/ray.h index ec434a1..f29bbde 100644 --- a/include/cglm/ray.h +++ b/include/cglm/ray.h @@ -42,7 +42,7 @@ glm_ray_triangle(vec3 origin, float *d) { vec3 edge1, edge2, p, t, q; float det, inv_det, u, v, dist; - const float epsilon = 0.000001; + const float epsilon = 0.000001f; glm_vec3_sub(v1, v0, edge1); glm_vec3_sub(v2, v0, edge2); @@ -54,32 +54,28 @@ glm_ray_triangle(vec3 origin, if (det > -epsilon && det < epsilon) return 0; - inv_det = 1.0 / det; + inv_det = 1.0f / det; glm_vec3_sub(origin, v0, t); u = inv_det * glm_vec3_dot(t, p); - if (u < 0.0 || u > 1.0) + if (u < 0.0f || u > 1.0f) return 0; glm_vec3_cross(t, edge1, q); v = inv_det * glm_vec3_dot(direction, q); - if (v < 0.0 || u + v > 1.0) + if (v < 0.0f || u + v > 1.0f) return 0; dist = inv_det * glm_vec3_dot(edge2, q); - if (dist > epsilon) { - if (d != NULL) { + + if (d) *d = dist; - } - return 1; - } - - return 0; + return dist > epsilon; } #endif From 78b2e2d2ccfcd431378b8f479010456e5a223f0e Mon Sep 17 00:00:00 2001 From: Uwila Date: Mon, 6 Apr 2020 11:38:27 +0200 Subject: [PATCH 06/11] Add tests for glm_ray_triangle --- test/src/test_ray.h | 34 ++++++++++++++++++++++++++++++++++ test/src/tests.c | 1 + test/tests.h | 6 ++++++ 3 files changed, 41 insertions(+) create mode 100644 test/src/test_ray.h diff --git a/test/src/test_ray.h b/test/src/test_ray.h new file mode 100644 index 0000000..a85ad8c --- /dev/null +++ b/test/src/test_ray.h @@ -0,0 +1,34 @@ +/* + * Copyright (c), Recep Aslantas. + * + * MIT License (MIT), http://opensource.org/licenses/MIT + * Full license can be found in the LICENSE file + */ + +#include "test_common.h" + +TEST_IMPL(GLM_PREFIX, ray_triangle) { + // Check whether a simple hit is recognized with the right distance + vec3 origin = {0.0f, 0.0f, 0.0f}; + vec3 direction = {1.0f, 0.0f, 0.0f}; + vec3 opposite = {-1.0f, 0.0f, 0.0f}; + vec3 v0 = {5.0f, -1.0f, 1.0f}; + vec3 v1 = {5.0f, -1.0f, -1.0f}; + vec3 v2 = {5.0f, 1.0f, 0.0f}; + float d; + bool hit; + + hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, &d); + ASSERT(hit); + ASSERT(fabsf(d - 5.0f) <= 0.0000009); + + // Check whether a simple miss works + hit = GLM(ray_triangle)(origin, opposite, v0, v1, v2, &d); + ASSERT(!hit); + + // Check that we can disregard distance and pass NULL pointer instead + hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, NULL); + ASSERT(hit); + + TEST_SUCCESS +} diff --git a/test/src/tests.c b/test/src/tests.c index 669b33c..956823f 100644 --- a/test/src/tests.c +++ b/test/src/tests.c @@ -23,6 +23,7 @@ #include "test_plane.h" #include "test_affine.h" #include "test_affine_mat.h" +#include "test_ray.h" #undef GLM #undef GLM_PREFIX diff --git a/test/tests.h b/test/tests.h index 4c9a552..83351a5 100644 --- a/test/tests.h +++ b/test/tests.h @@ -218,6 +218,9 @@ TEST_DECLARE(clamp) /* euler */ TEST_DECLARE(euler) +/* ray */ +TEST_DECLARE(glm_ray_triangle) + /* quat */ TEST_DECLARE(MACRO_GLM_QUAT_IDENTITY_INIT) TEST_DECLARE(MACRO_GLM_QUAT_IDENTITY) @@ -905,6 +908,9 @@ TEST_LIST { /* euler */ TEST_ENTRY(euler) + /* ray */ + TEST_ENTRY(glm_ray_triangle) + /* quat */ TEST_ENTRY(MACRO_GLM_QUAT_IDENTITY_INIT) TEST_ENTRY(MACRO_GLM_QUAT_IDENTITY) From 90eb164a438d640b40064bb7961ecc7d90f39c7d Mon Sep 17 00:00:00 2001 From: Uwila Date: Mon, 6 Apr 2020 11:42:23 +0200 Subject: [PATCH 07/11] Add tests for cglm_ray_triangle --- test/src/tests.c | 1 + test/tests.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/src/tests.c b/test/src/tests.c index 956823f..ea9f902 100644 --- a/test/src/tests.c +++ b/test/src/tests.c @@ -45,6 +45,7 @@ #include "test_plane.h" #include "test_affine.h" #include "test_affine_mat.h" +#include "test_ray.h" #undef GLM #undef GLM_PREFIX diff --git a/test/tests.h b/test/tests.h index 83351a5..1ed75d8 100644 --- a/test/tests.h +++ b/test/tests.h @@ -220,6 +220,7 @@ TEST_DECLARE(euler) /* ray */ TEST_DECLARE(glm_ray_triangle) +TEST_DECLARE(glmc_ray_triangle) /* quat */ TEST_DECLARE(MACRO_GLM_QUAT_IDENTITY_INIT) @@ -910,6 +911,7 @@ TEST_LIST { /* ray */ TEST_ENTRY(glm_ray_triangle) + TEST_ENTRY(glmc_ray_triangle) /* quat */ TEST_ENTRY(MACRO_GLM_QUAT_IDENTITY_INIT) From 7bcd7609eb863658c47d1a1b0877567e6db98dcc Mon Sep 17 00:00:00 2001 From: Uwila Date: Mon, 6 Apr 2020 11:43:12 +0200 Subject: [PATCH 08/11] Fix test_ray.h style --- test/src/test_ray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/test_ray.h b/test/src/test_ray.h index a85ad8c..b7816f0 100644 --- a/test/src/test_ray.h +++ b/test/src/test_ray.h @@ -11,7 +11,7 @@ TEST_IMPL(GLM_PREFIX, ray_triangle) { // Check whether a simple hit is recognized with the right distance vec3 origin = {0.0f, 0.0f, 0.0f}; vec3 direction = {1.0f, 0.0f, 0.0f}; - vec3 opposite = {-1.0f, 0.0f, 0.0f}; + vec3 opposite = {-1.0f, 0.0f, 0.0f}; vec3 v0 = {5.0f, -1.0f, 1.0f}; vec3 v1 = {5.0f, -1.0f, -1.0f}; vec3 v2 = {5.0f, 1.0f, 0.0f}; From 38cb693834aef1acb2a573f48b45198ccd33d195 Mon Sep 17 00:00:00 2001 From: Uwila Date: Mon, 6 Apr 2020 13:51:29 +0200 Subject: [PATCH 09/11] Update vcxproj files for test_ray --- win/cglm-test.vcxproj | 1 + win/cglm-test.vcxproj.filters | 3 +++ 2 files changed, 4 insertions(+) diff --git a/win/cglm-test.vcxproj b/win/cglm-test.vcxproj index 1c0916d..6599103 100644 --- a/win/cglm-test.vcxproj +++ b/win/cglm-test.vcxproj @@ -42,6 +42,7 @@ + diff --git a/win/cglm-test.vcxproj.filters b/win/cglm-test.vcxproj.filters index c81dc11..b8f7326 100644 --- a/win/cglm-test.vcxproj.filters +++ b/win/cglm-test.vcxproj.filters @@ -79,5 +79,8 @@ src + + src + \ No newline at end of file From 47807b79558ada4a4483062376b35980f2903358 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Mon, 6 Apr 2020 16:44:07 +0300 Subject: [PATCH 10/11] Update test_ray.h --- test/src/test_ray.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/src/test_ray.h b/test/src/test_ray.h index b7816f0..c1b0281 100644 --- a/test/src/test_ray.h +++ b/test/src/test_ray.h @@ -8,25 +8,25 @@ #include "test_common.h" TEST_IMPL(GLM_PREFIX, ray_triangle) { - // Check whether a simple hit is recognized with the right distance - vec3 origin = {0.0f, 0.0f, 0.0f}; - vec3 direction = {1.0f, 0.0f, 0.0f}; - vec3 opposite = {-1.0f, 0.0f, 0.0f}; - vec3 v0 = {5.0f, -1.0f, 1.0f}; - vec3 v1 = {5.0f, -1.0f, -1.0f}; - vec3 v2 = {5.0f, 1.0f, 0.0f}; + /* Check whether a simple hit is recognized with the right distance */ + vec3 origin = { 0.0f, 0.0f, 0.0f}; + vec3 direction = { 1.0f, 0.0f, 0.0f}; + vec3 opposite = {-1.0f, 0.0f, 0.0f}; + vec3 v0 = { 5.0f, -1.0f, 1.0f}; + vec3 v1 = { 5.0f, -1.0f, -1.0f}; + vec3 v2 = { 5.0f, 1.0f, 0.0f}; float d; - bool hit; + bool hit; hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, &d); ASSERT(hit); ASSERT(fabsf(d - 5.0f) <= 0.0000009); - // Check whether a simple miss works + /* Check whether a simple miss works */ hit = GLM(ray_triangle)(origin, opposite, v0, v1, v2, &d); ASSERT(!hit); - // Check that we can disregard distance and pass NULL pointer instead + /* Check that we can disregard distance and pass NULL pointer instead */ hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, NULL); ASSERT(hit); From f79674f66a75e8d02fa6930da6d4d046d8403969 Mon Sep 17 00:00:00 2001 From: Uwila Date: Tue, 7 Apr 2020 21:39:27 +0200 Subject: [PATCH 11/11] Link contributors' avatars to the correct page --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5243140..8924401 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,7 @@ You can pass matrices the same way to other APIs e.g. Vulkan, DX... ## Contributors This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. - + ## Backers