Skip to content

Avoid conflicting template parameters in AABB#2256

Merged
alecjacobson merged 1 commit intomainfrom
alecjacobson/aabb-dim
Aug 30, 2023
Merged

Avoid conflicting template parameters in AABB#2256
alecjacobson merged 1 commit intomainfrom
alecjacobson/aabb-dim

Conversation

@alecjacobson
Copy link
Copy Markdown
Contributor

@alecjacobson alecjacobson commented Aug 29, 2023

Fixes #436

This uses class template specialization to avoid ever calling AABB with conflicting template params (e.g., MatrixX3D and DIM=2). The old code was all dynamic so it lead to conflicting compilation paths.

I claim this is a reasonable C++11 solution. If we were using C++17 then we could use if constexpr which would be significantly less code and more readable.

Unless I notice something broken with this, I'll also fix the nasty dynamic situation in signed_distance similarly. And then we can add [to AABB] a

static_assert(DerivedV::ColsAtCompileTime == DIM || DerivedV::ColsAtCompileTime == Eigen::Dynamic,"V's #columns must either match DIM or be Dynamic.");

So that bogus compilation paths get caught.

@alecjacobson
Copy link
Copy Markdown
Contributor Author

If I can do this right, then I can get rid of this junk:

// This is a bullshit template because AABB annoyingly needs templates for bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

igl::hausdorff does not work with MatrixX3d

1 participant