Skip to content
Snippets Groups Projects
Commit 4e23f95c authored by Tom Fischer's avatar Tom Fischer
Browse files

[GL] Use Eigen in rotatePolygonToXY.

parent c9095b99
No related branches found
No related tags found
No related merge requests found
......@@ -363,7 +363,7 @@ void computeAndInsertAllIntersectionPoints(GeoLib::PointVec &pnt_vec,
}
GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in,
MathLib::Vector3 & plane_normal)
Eigen::Vector3d& plane_normal)
{
// 1 copy all points
auto* polygon_pnts(new std::vector<GeoLib::Point*>);
......@@ -373,12 +373,8 @@ GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in,
}
// 2 rotate points
auto const [normal, d_polygon] = GeoLib::getNewellPlane(*polygon_pnts);
// ToDo (TF) remove when computeRotationMatrixToXY uses Eigen
plane_normal[0] = normal[0];
plane_normal[1] = normal[1];
plane_normal[2] = normal[2];
double d_polygon;
std::tie(plane_normal, d_polygon) = GeoLib::getNewellPlane(*polygon_pnts);
MathLib::DenseMatrix<double> rot_mat(3,3);
GeoLib::computeRotationMatrixToXY(plane_normal, rot_mat);
GeoLib::rotatePoints(rot_mat, *polygon_pnts);
......
......@@ -223,7 +223,7 @@ void computeAndInsertAllIntersectionPoints(GeoLib::PointVec &pnt_vec,
* @return a rotated polygon
*/
GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in,
MathLib::Vector3 & plane_normal);
Eigen::Vector3d& plane_normal);
/// Sorts the vector of segments such that the \f$i\f$-th segment is connected
/// with the \f$i+1\f$st segment, i.e. the end point of the \f$i\f$-th segment
......
......@@ -27,11 +27,8 @@ std::vector<bool> markNodesOutSideOfPolygon(
std::vector<MeshLib::Node*> const& nodes, GeoLib::Polygon const& polygon)
{
// *** rotate polygon to xy_plane
MathLib::Vector3 tmp_normal;
GeoLib::Polygon rot_polygon(GeoLib::rotatePolygonToXY(polygon, tmp_normal));
// ToDo (TF) remove when computeRotationMatrixToXY accepts Eigen normal
auto const normal = Eigen::Map<Eigen::Vector3d>(
const_cast<double*>(tmp_normal.getCoords()));
Eigen::Vector3d normal;
GeoLib::Polygon rot_polygon(GeoLib::rotatePolygonToXY(polygon, normal));
// *** rotate mesh nodes to xy-plane
// 1 copy all mesh nodes to GeoLib::Points
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment