WIP: adjusting sch_hull_sat API to allow providing transforms.
parent
c6daa7ec21
commit
cf87db975c
|
@ -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);
|
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);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sch_hull_sat(
|
bool sch_hull_sat(const sch_hull* hull_A, simd4x4f* trans_A, const sch_hull* hull_B, simd4x4f* trans_B, sch_manifold* result) {
|
||||||
const sch_hull* hull_A,
|
|
||||||
const sch_hull* hull_B,
|
|
||||||
sch_manifold* result) {
|
|
||||||
sch_face_query query_A_B;
|
sch_face_query query_A_B;
|
||||||
sch_query_face_directions(hull_A, hull_B, &query_A_B);
|
sch_query_face_directions(hull_A, hull_B, &query_A_B);
|
||||||
if (query_A_B.dist > 0.f) {
|
if (query_A_B.dist > 0.f) {
|
||||||
|
|
|
@ -341,7 +341,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_transform(&hull_B, translation);
|
sch_hull_transform(&hull_B, translation);
|
||||||
|
|
||||||
THEN("Boxes separated") {
|
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);
|
REQUIRE(separated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +353,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_translate(&hull_B, 1.1f, 0.f, 0.f);
|
sch_hull_translate(&hull_B, 1.1f, 0.f, 0.f);
|
||||||
|
|
||||||
THEN("Boxes overlap") {
|
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(!separated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,7 +366,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_translate(&hull_B, sqrt(2.f), 0.f, 0.f);
|
sch_hull_translate(&hull_B, sqrt(2.f), 0.f, 0.f);
|
||||||
|
|
||||||
THEN("Boxes overlap") {
|
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(!separated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +376,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_translate(&hull_B, 0.001f, 0.f, 0.f);
|
sch_hull_translate(&hull_B, 0.001f, 0.f, 0.f);
|
||||||
|
|
||||||
THEN("Boxes are separated") {
|
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);
|
REQUIRE(separated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,7 +389,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_translate(&hull_B, 0., 0.f, 0.97f);
|
sch_hull_translate(&hull_B, 0., 0.f, 0.97f);
|
||||||
|
|
||||||
THEN("Boxes overlap") {
|
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(!separated);
|
||||||
REQUIRE(manifold.num_points == 8);
|
REQUIRE(manifold.num_points == 8);
|
||||||
}
|
}
|
||||||
|
@ -391,7 +401,9 @@ TEST_CASE ("UnitCubeSAT", "[sconvcol]") {
|
||||||
sch_hull_translate(&hull_B, 1., 0.f, 1.00f);
|
sch_hull_translate(&hull_B, 1., 0.f, 1.00f);
|
||||||
|
|
||||||
THEN("Boxes overlap") {
|
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(!separated);
|
||||||
REQUIRE(manifold.num_points == 8);
|
REQUIRE(manifold.num_points == 8);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue