From cf87db975c4e9677087ff48150bb02eb538bc733 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 7 Nov 2021 11:31:24 +0100 Subject: [PATCH] WIP: adjusting sch_hull_sat API to allow providing transforms. --- src/sconvcol.h | 7 ++----- tests/sconvcolTests.cc | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/sconvcol.h b/src/sconvcol.h index 4f7c47e..1bcb2e0 100644 --- a/src/sconvcol.h +++ b/src/sconvcol.h @@ -162,7 +162,7 @@ void sch_create_face_contact (const sch_face_query* query_A_B, const sch_hull* h void sch_create_edge_contact (const sch_edge_query* query_edge, const sch_hull* hull_A, const sch_hull* hull_B, sch_manifold* result); -bool sch_hull_sat(const sch_hull* hull_A, const sch_hull* hull_B, sch_manifold* result); +bool sch_hull_sat(const sch_hull* hull_A, simd4x4f* trans_A, const sch_hull* hull_B, simd4x4f* trans_B, sch_manifold* result); int sch_hull_is_vertex_concave(const sch_hull* hull, const simd4f p); @@ -678,10 +678,7 @@ void sch_create_edge_contact (const sch_edge_query* query_edge, const sch_hull* #endif } -bool sch_hull_sat( - const sch_hull* hull_A, - const sch_hull* hull_B, - sch_manifold* result) { +bool sch_hull_sat(const sch_hull* hull_A, simd4x4f* trans_A, const sch_hull* hull_B, simd4x4f* trans_B, sch_manifold* result) { sch_face_query query_A_B; sch_query_face_directions(hull_A, hull_B, &query_A_B); if (query_A_B.dist > 0.f) { diff --git a/tests/sconvcolTests.cc b/tests/sconvcolTests.cc index 90201c4..9b24e35 100644 --- a/tests/sconvcolTests.cc +++ b/tests/sconvcolTests.cc @@ -341,7 +341,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_transform(&hull_B, translation); THEN("Boxes separated") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(separated); } } @@ -351,7 +353,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_translate(&hull_B, 1.1f, 0.f, 0.f); THEN("Boxes overlap") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(!separated); } } @@ -362,7 +366,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_translate(&hull_B, sqrt(2.f), 0.f, 0.f); THEN("Boxes overlap") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(!separated); } @@ -370,7 +376,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_translate(&hull_B, 0.001f, 0.f, 0.f); THEN("Boxes are separated") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(separated); } } @@ -381,7 +389,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_translate(&hull_B, 0., 0.f, 0.97f); THEN("Boxes overlap") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(!separated); REQUIRE(manifold.num_points == 8); } @@ -391,7 +401,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") { sch_hull_translate(&hull_B, 1., 0.f, 1.00f); THEN("Boxes overlap") { - bool separated = sch_hull_sat(&hull_A, &hull_B, &manifold); + simd4x4f identity; + simd4x4f_identity(&identity); + bool separated = sch_hull_sat(&hull_A, &identity, &hull_B, &identity, &manifold); REQUIRE(!separated); REQUIRE(manifold.num_points == 8); }