From c5fc66ee58f2c60f2d226868bb1cf5b91badaf53 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 1 Oct 2022 20:59:36 -0500 Subject: add ode --- .../libccd/src/testsuites/spheresphere.c | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c (limited to 'libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c') diff --git a/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c b/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c new file mode 100644 index 0000000..36628f6 --- /dev/null +++ b/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c @@ -0,0 +1,99 @@ +#include +#include +#include "support.h" +#include + +TEST(spheresphereSetUp) +{ +} + +TEST(spheresphereTearDown) +{ +} + +TEST(spheresphereAlignedX) +{ + ccd_t ccd; + CCD_SPHERE(s1); + CCD_SPHERE(s2); + size_t i; + int res; + + CCD_INIT(&ccd); + ccd.support1 = ccdSupport; + ccd.support2 = ccdSupport; + + s1.radius = 0.35; + s2.radius = .5; + + ccdVec3Set(&s1.pos, -5., 0., 0.); + for (i = 0; i < 100; i++){ + res = ccdGJKIntersect(&s1, &s2, &ccd); + + if (i < 42 || i > 58){ + assertFalse(res); + }else{ + assertTrue(res); + } + + s1.pos.v[0] += 0.1; + } +} + +TEST(spheresphereAlignedY) +{ + ccd_t ccd; + CCD_SPHERE(s1); + CCD_SPHERE(s2); + size_t i; + int res; + + CCD_INIT(&ccd); + ccd.support1 = ccdSupport; + ccd.support2 = ccdSupport; + + s1.radius = 0.35; + s2.radius = .5; + + ccdVec3Set(&s1.pos, 0., -5., 0.); + for (i = 0; i < 100; i++){ + res = ccdGJKIntersect(&s1, &s2, &ccd); + + if (i < 42 || i > 58){ + assertFalse(res); + }else{ + assertTrue(res); + } + + s1.pos.v[1] += 0.1; + } +} + +TEST(spheresphereAlignedZ) +{ + ccd_t ccd; + CCD_SPHERE(s1); + CCD_SPHERE(s2); + size_t i; + int res; + + CCD_INIT(&ccd); + ccd.support1 = ccdSupport; + ccd.support2 = ccdSupport; + + s1.radius = 0.35; + s2.radius = .5; + + ccdVec3Set(&s1.pos, 0., 0., -5.); + for (i = 0; i < 100; i++){ + res = ccdGJKIntersect(&s1, &s2, &ccd); + + if (i < 42 || i > 58){ + assertFalse(res); + }else{ + assertTrue(res); + } + + s1.pos.v[2] += 0.1; + } +} -- cgit v1.2.1