Add line, plane, ray and segments, split math unit test
Added some basic geometric primitives such as planes, rays, segments and lines (plus some extra functions like xProject, xBarycentric, Lerpf), as well as some intersection tests between them. Additionally, I split massive math test into smaller ones and tweaked unit test library (testing no longer stops after first failure).
This commit is contained in:
@@ -28,12 +28,20 @@ typedef int (*BH_UnitCallback)(void);
|
||||
if (BH_VERIFY_DELTA < 0.0) \
|
||||
BH_VERIFY_DELTA = -BH_VERIFY_DELTA; \
|
||||
if (BH_VERIFY_DELTA > (e)) { \
|
||||
printf("%s:%d\t%s (differs by %f)\n", __FILE__, __LINE__, #x " == " #y, BH_VERIFY_DELTA); \
|
||||
printf("%s:%d\t%s (differs by %f)\n", \
|
||||
__FILE__, __LINE__, #x " == " #y, BH_VERIFY_DELTA); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define BH_UNIT_TEST(name) \
|
||||
static int unit##name(void)
|
||||
|
||||
|
||||
#define BH_UNIT_ADD(name) \
|
||||
BH_UnitAdd(#name, unit##name)
|
||||
|
||||
|
||||
/**
|
||||
* Adds unit test \a cb with name \a name for the testing.
|
||||
|
||||
Reference in New Issue
Block a user