mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Changing the internal representation of Point / Pointf / Point3 / Pointf3 to Eigen Matrix types:
Changed the Point3 / Pointf3 to composite Eigen Vec3crd / Vec3d. Point3 is no more derived from Point, Pointf3 is no more derived from Pointf. Introduced Transform2f/3f/2d/3d types as aliases to Eigen::Transform.
This commit is contained in:
parent
86da661097
commit
f34252a27b
15 changed files with 197 additions and 303 deletions
|
@ -253,9 +253,9 @@ void BoundingBox::align_to_grid(const coord_t cell_size)
|
|||
}
|
||||
}
|
||||
|
||||
BoundingBoxf3 BoundingBoxf3::transformed(const std::vector<float>& matrix) const
|
||||
BoundingBoxf3 BoundingBoxf3::transformed(const Transform3f& matrix) const
|
||||
{
|
||||
Eigen::Matrix<float, 3, 8> vertices;
|
||||
Eigen::Matrix<float, 3, 8, Eigen::DontAlign> vertices;
|
||||
|
||||
vertices(0, 0) = (float)min.x(); vertices(1, 0) = (float)min.y(); vertices(2, 0) = (float)min.z();
|
||||
vertices(0, 1) = (float)max.x(); vertices(1, 1) = (float)min.y(); vertices(2, 1) = (float)min.z();
|
||||
|
@ -266,9 +266,7 @@ BoundingBoxf3 BoundingBoxf3::transformed(const std::vector<float>& matrix) const
|
|||
vertices(0, 6) = (float)max.x(); vertices(1, 6) = (float)max.y(); vertices(2, 6) = (float)max.z();
|
||||
vertices(0, 7) = (float)min.x(); vertices(1, 7) = (float)max.y(); vertices(2, 7) = (float)max.z();
|
||||
|
||||
Eigen::Transform<float, 3, Eigen::Affine> m;
|
||||
::memcpy((void*)m.data(), (const void*)matrix.data(), 16 * sizeof(float));
|
||||
Eigen::Matrix<float, 3, 8> transf_vertices = m * vertices.colwise().homogeneous();
|
||||
Eigen::Matrix<float, 3, 8, Eigen::DontAlign> transf_vertices = matrix * vertices.colwise().homogeneous();
|
||||
|
||||
float min_x = transf_vertices(0, 0);
|
||||
float max_x = transf_vertices(0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue