Fix: Remove special case from curve segment size function

The idea that curves with two points cannot be cyclic came from some
existing code, but there's not fundamental reason for it, so remove the
check in this function. The case can be handled elsewhere if necessary.
This commit is contained in:
Hans Goudey 2022-03-29 19:56:38 -05:00
parent 72d25fa41d
commit 87e9451d66
Notes: blender-bot 2023-02-13 11:51:52 +01:00
Referenced by commit e26c89cd76, Fix: Failing curves test after recent commit
1 changed files with 3 additions and 4 deletions

View File

@ -351,13 +351,12 @@ class CurvesGeometry : public ::CurvesGeometry {
namespace curves {
/**
* The number of segments between control points, accounting for the last segment of cyclic curves,
* and the fact that curves with two points cannot be cyclic. The logic is simple, but this
* function should be used to make intentions clearer.
* The number of segments between control points, accounting for the last segment of cyclic
* curves. The logic is simple, but this function should be used to make intentions clearer.
*/
inline int curve_segment_size(const int points_num, const bool cyclic)
{
return (cyclic && points_num > 2) ? points_num : points_num - 1;
return cyclic ? points_num : points_num - 1;
}
namespace bezier {