ZeroSlopeSpline
The ZeroSlopeSpline class represents a spline with a constant Y-value, effectively having a slope of zero. This is useful for scenarios where a flat, horizontal trajectory or interpolation is required.
Constructor
ZeroSlopeSpline(double returnValue): Creates a newZeroSlopeSplineinstance. ThereturnValueparameter defines the constant Y-value that the spline will always return.
Instance Methods
interpolateY(double x): Returns the constantreturnValueregardless of the inputxvalue. This method fulfills theSplineinterface contract for Y-interpolation.interpolate(double x): Returns aPointXYobject where the X-coordinate is the inputxand the Y-coordinate is the constantreturnValue. This method fulfills theSplineinterface contract for point interpolation.getStartPoint(): Returns aPointXYrepresenting the conceptual start point of the spline. For aZeroSlopeSpline, this is(0, returnValue).getEndPoint(): Returns aPointXYrepresenting the conceptual end point of the spline. For aZeroSlopeSpline, this is(0, returnValue).