Cleanup: Add asserts, remove default case

This commit is contained in:
Hans Goudey 2022-03-25 09:12:31 -05:00
parent cea51c1bb5
commit 1243cb803e
2 changed files with 9 additions and 8 deletions

View File

@ -149,6 +149,10 @@ static void interpolate_to_evaluated(const Span<T> src,
const Span<int> evaluated_offsets,
MutableSpan<T> dst)
{
BLI_assert(!src.is_empty());
BLI_assert(dst.size() == src.size());
BLI_assert(evaluated_offsets.last() == dst.size());
linear_interpolation(src.first(), src[1], dst.take_front(evaluated_offsets.first()));
threading::parallel_for(

View File

@ -702,28 +702,25 @@ void CurvesGeometry::interpolate_to_evaluated(const int curve_index,
case CURVE_TYPE_CATMULL_ROM:
curves::catmull_rom::interpolate_to_evaluated(
src, this->cyclic()[curve_index], this->resolution()[curve_index], dst);
break;
return;
case CURVE_TYPE_POLY:
dst.type().copy_assign_n(src.data(), dst.data(), src.size());
break;
return;
case CURVE_TYPE_BEZIER:
curves::bezier::interpolate_to_evaluated(
src, this->runtime->bezier_evaluated_offsets.as_span().slice(points), dst);
break;
return;
case CURVE_TYPE_NURBS:
curves::nurbs::interpolate_to_evaluated(this->runtime->nurbs_basis_cache[curve_index],
this->nurbs_orders()[curve_index],
this->nurbs_weights().slice(points),
src,
dst);
break;
default:
BLI_assert_unreachable();
break;
return;
}
BLI_assert_unreachable();
}
/** \} */
/* -------------------------------------------------------------------- */