Removes unnecessary operations when combining horizontal and vertical placement matrices for alignment

This commit is contained in:
Richard Brice
2026-05-01 14:13:00 -07:00
committed by Thomas Krijnen
parent cd51c3ae85
commit 820077a94b
-14
View File
@@ -104,14 +104,6 @@ struct gradient_fn_evaluator : public fn_evaluator {
auto xy = horizontal_evaluator_.evaluate(u);
auto uz = vertical_evaluator_.evaluate(u);
// curvature is stored in row 3 - capture it and remove it from the xy and uz matrices
// so the matrix operations (ie multiplication) works correct.y
auto horizontal_curvature = xy.row(3);
xy.row(3) = Eigen::Vector4d(0, 0, 0, 1);
auto vertical_curvature = uz.row(3);
uz.row(3) = Eigen::Vector4d(0, 0, 0, 1);
uz(0, 3) = 0.0; // x is distance along. zero it out so it doesn't add to the x from horizontal
uz.col(1).swap(uz.col(2)); // uz is 2D in distance along - y plane, swap y and z so elevations become z
uz.row(1).swap(uz.row(2));
@@ -119,12 +111,6 @@ struct gradient_fn_evaluator : public fn_evaluator {
Eigen::Matrix4d m;
m = xy * uz; // combine horizontal and vertical
// Put curvature back into the solution matrix
// curvature for vertical is in column 0, need it to be in column 1
// so it doesn't add to curvature for horizontal
std::swap(vertical_curvature(0), vertical_curvature(1));
m.row(3) = horizontal_curvature + vertical_curvature;
return m;
}