|
|
@ -66,14 +66,18 @@ static inline process_return_type_t<Routine> evaluate(const extrude_polyline |
|
|
|
{ |
|
|
|
const auto world_to_axis = inversed_affine_transform(desc.axis_to_world); |
|
|
|
const auto local_p = world_to_axis * Eigen::Vector4d{point[0], point[1], point[2], 1}; |
|
|
|
const auto [axis_closest_param, _] = desc.axis.calculate_closest_param(local_p.topRows<3>()); |
|
|
|
const auto [axis_closest_param, axis_closest_t] = desc.axis.calculate_closest_param(local_p.topRows<3>()); |
|
|
|
const auto TBN = get_local_TBN(desc.axis, local_p, axis_closest_param.point, axis_closest_param.t); |
|
|
|
const auto inv_TBN = inversed_affine_transform(TBN); |
|
|
|
|
|
|
|
// TODO: add support for non-parallel (ray vs. profile plane) case
|
|
|
|
// for now just assume that profile plane is parallel to axis
|
|
|
|
auto [profile_closest_param, dist] = desc.profile.calculate_closest_param((inv_TBN * local_p).topRows<3>()); |
|
|
|
dist *= desc.profile.pmc((inv_TBN * local_p).topRows<3>(), profile_closest_param); |
|
|
|
if (!desc.axis.isEnd(axis_closest_t) || !axis_closest_param.is_peak_value) { |
|
|
|
// when the point is two sides away, and pmc is always true
|
|
|
|
dist *= desc.profile.pmc((inv_TBN * local_p).topRows<2>(), profile_closest_param); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// transform closest point to world space
|
|
|
|
// the distance should be unchanged during transformation, since no scaling is involved
|
|
|
|