MCPcopy Create free account
hub / github.com/crownengine/crown / test_obb

Function test_obb

src/core/unit_tests.cpp:1067–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065}
1066
1067static void test_obb()
1068{
1069 {
1070 OBB a;
1071 obb::reset(a);
1072 ENSURE(a.tm == MATRIX4X4_IDENTITY);
1073 ENSURE(fequal(a.half_extents.x, 0.0f, 0.00001f));
1074 ENSURE(fequal(a.half_extents.y, 0.0f, 0.00001f));
1075 ENSURE(fequal(a.half_extents.z, 0.0f, 0.00001f));
1076 }
1077 {
1078 OBB a;
1079 obb::reset(a);
1080 a.half_extents = { 0.5f, 0.5f, 0.5f };
1081
1082 Vector3 ray_origin = { 0.0f, -2.0f, 0.25 };
1083 Vector3 ray_target = { 0.0f, 0.0f, 0.25 };
1084 Vector3 ray_direction = ray_target - ray_origin;
1085 normalize(ray_direction);
1086 ENSURE(ray_obb_intersection(ray_origin, ray_direction, a.tm, a.half_extents) != -1.0f);
1087 }
1088 {
1089 OBB a;
1090 obb::reset(a);
1091 a.half_extents = { 0.5f, 0.5f, 0.5f };
1092 set_scale(a.tm, { 0.01f, 0.01f, 0.01f });
1093
1094 Vector3 ray_origin = { 0.0f, -2.0f, 0.25 };
1095 Vector3 ray_target = { 0.0f, 0.0f, 0.25 };
1096 Vector3 ray_direction = ray_target - ray_origin;
1097 normalize(ray_direction);
1098 ENSURE(ray_obb_intersection(ray_origin, ray_direction, a.tm, a.half_extents) == -1.0f);
1099 }
1100}
1101
1102static void test_murmur()
1103{

Callers

nothing calls this directly

Calls 3

normalizeFunction · 0.85
ray_obb_intersectionFunction · 0.85
resetFunction · 0.50

Tested by

no test coverage detected