-- Public Constructors


function CubicSpline.Natural(points)
	local self = setmetatable({}, CubicSpline)
	
	self.Points = points
	self.Coefficients = {naturalCubicSpline(points)}

	local lengths = {}
	local total = 0
	for k = 1, #points - 1 do
		lengths[k] = integrate(self, k, 1)
		total = total + lengths[k]
	end
	
	self.Lengths = lengths
	self.TotalLength = total
	
	return self
end

function CubicSpline.Clamped(points, fpo, fpn)
	local self = setmetatable({}, CubicSpline)
	
	self.Points = points
	self.Coefficients = {clampedCubicSpline(points, fpo, fpn)}

	local lengths = {}
	local total = 0
	for k = 1, #points - 1 do
		lengths[k] = integrate(self, k, 1)
		total = total + lengths[k]
	end
	
	self.Lengths = lengths
	self.TotalLength = total
	
	return self
end
