1. Anders Ruud
  2. love

Issues

Issue #759 resolved

Would BezierCurve:getControlPointCount be better than BezierCurve:getDegree?

hahawoo
created an issue

As always I have no idea what I'm talking about, but would getControlPointCount be better than getDegree?

  • It's perhaps more immediately obvious what getControlPointCount does.
  • It's consistent with other objects which have get*Count functions.
  • Maybe it's more... "general" in a sense, as in,

getControlPointCount - 1 is the degree of the BezierCurve.

getControlPointCount is the number of control points in the BezierCurve.

is maybe kind of easier to understand than

getDegree is the degree of the BezierCurve.

getDegree + 1 is the number of control points in the BezierCurve.

Comments (3)

  1. Matthias Richter

    The degree is a defining characteristic of a Bezier curve (see here). It just so happens that degree is number-of-control-points - 1.

    Other kinds of (piecewise) polynomial curves may have different relationships, e.g. B-Spline curves, where the number of control points is (almost) not related to the degree of the curve.

  2. Alex Szpakowski

    Maybe it would be a good idea to add getControlPointCount (even though it's a bit of a mouthful) without removing getDegree?

    LÖVE's API tends to consistently provide something like:

    for i=1, Foo:getBarCount() do
        Foo:setBar(i, ...)
    end
    

    which getControlPointCount fits in with - but getDegree also has meaning beyond just the number of control points.

  3. Log in to comment