ethz-asl / cad-percept

Bringing meshes to robotics.
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

CGAL/Eigen Conversion Adapters to streamline interfaces #39

Closed michaelpantic closed 5 years ago

michaelpantic commented 5 years ago

More PRs! Sorry :-) Warning: Code in this PR is made highly generic and solves a very technical problem but will increase code readability for other functions a lot. Code readability of this part though...well I tried my best.

Content of PR: Custom data type that allows us to write functions that consume/return cgal::Vector/Eigen::Vector3d/cgal::Point at the same time without ever having to explicitly convert/cast. Same applies for cgal::Vector_2/Eigen::Vector2d/cgal::Point_2, depending on template parameter N.

This PR can be merged independently of the others.

See following code comment and/or tests in file test_cgal_eigen_adapter.cpp for example.

Text from code comment:

This header-only library provides functionality to design functions such that they automatically accept eigen and cgal vectors without templates/overloading and the like. Makes Eigen::Vector3d / cgal::Vector_3 / cgal::Point_3 interchangeable.

Examples:

Of course any combination of the above 3 is also valid.

Example from code: See public methods from e.g. https://github.com/ethz-asl/cad-percept/blob/9215a98a04d1ea2d3618a6ad773060548b2b913a/cpt_planning/include/cpt_planning/coordinates/barycentric.h#L15

Defines barycentric coordinates for 2d and 3d types and allows usage and return of any mixture of cgal/eigen types with only 4 methods defined !

ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

michaelpantic commented 5 years ago

Decided to extend implementation to 2D points/vectors, as I need that too, so wait with review.

Update: Done. Ready for review.

ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

michaelpantic commented 5 years ago
ethzasl-jenkins commented 5 years ago

Test PASSed.

ethzasl-jenkins commented 5 years ago

Test PASSed.

michaelpantic commented 5 years ago

@hermannsblum thanks for reviewing! merging...