Polygon Mesh Processing Library
Loading...
Searching...
No Matches
Interfacing with Eigen

PMP supports some level of interoperability with Eigen. The pmp::Matrix and pmp::Vector classes can be constructed and assigned from Eigen matrix and vector types. In addition, it possible to cast the pmp::Matrix and pmp::Vector classes to Eigen.

Here is an example for constructing a PMP dvec3 from an Eigen::Vector3d:

// construct form Eigen
Eigen::Vector3d eigen_vector(1.0, 2.0, 3.0);
pmp::dvec3 pmp_vector(eigen_vector);
Generic class for matrices.
Definition: mat_vec.h:27

Here is an example for assigning a PMP dvec3 from an Eigen::Vector3d:

// assign from Eigen
Eigen::Vector3d eigen_vector(1.0, 2.0, 3.0);
pmp::dvec3 pmp_vector;
// ...
pmp_vector = eigen_vector;

Finally, here is an example for casting a PMP vec3 from an Eigen::Vector3f:

// cast to Eigen
pmp::vec3 pmp_vector(1.0, 2.0, 3.0);
auto eigen_vector = static_cast<Eigen::Vector3f>(pmp_vector);

See the reference documentation for pmp::Matrix and pmp::Vector for more details.