fix: materialize Eigen cast expression before passing to distance_to_squared

Eigen's .cast<T>() returns a lazy CwiseUnaryOp expression, not a materialized
Matrix. The distance_to_squared overload taking a nearest_point output parameter
expects a concrete Eigen::Matrix, so template deduction fails on clang-cl.

Materialize the cast into a local Vec variable before passing it.
MSVC accepted the expression directly; clang-cl correctly rejects it.
This commit is contained in:
Gabriel
2026-06-24 00:36:41 -03:00
parent b9e1db41a0
commit a636243ec0

View File

@@ -32,7 +32,8 @@ namespace AABBTreeLines {
{
Vec<LineType::Dim, typename LineType::Scalar> nearest_point;
const LineType& line = lines[primitive_index];
squared_distance = line_alg::distance_to_squared(line, origin.template cast<typename LineType::Scalar>(), &nearest_point);
const Vec<LineType::Dim, typename LineType::Scalar> origin_cast = origin.template cast<typename LineType::Scalar>();
squared_distance = line_alg::distance_to_squared(line, origin_cast, &nearest_point);
return nearest_point.template cast<ScalarType>();
}
};