 class LinearInterpolator extends AbstractInterpolator
 	interpolate: (t) ->
 		k = Math.floor t
-		a = @getClippedInput k
-		b = @getClippedInput k+1
 		#Translate t to interpolate between k and k+1
 		t -= k
-		return (1-t)*a + (t)*b
+		return (1-t)*@getClippedInput(k) + (t)*@getClippedInput(k+1)
 
 
 class CubicInterpolator extends AbstractInterpolator
 	constructor: (array, config)->
+		#clamp cubic tension to [0,1] range
 		@tangentFactor = 1 - Math.max 0, Math.min 1, config.cubicTension
 		super
 

	throw 'Non-vector in Smooth() input' unless getType(v) is 'Array'
	throw 'Inconsistent dimension in Smooth() input' unless v.length is dimension
	validateNumber n for n in v

isValidNumber = (n) -> (getType(n) is 'Number') and isFinite(n) and not isNaN(n)



			else throw "Invalid element type: #{dataType}"

	# Determine the end of the original function's domain
	if config.clip is 'periodic' then baseDomainEnd = arr.length #after last element for periodic
	else baseDomainEnd = arr.length - 1 #at last element for non-periodic

	config.scaleTo ||= baseDomainEnd #default scales to the end of the original domain for no effect
	
	properties.domain = normalizeScaleTo config.scaleTo
	smoothFunc = makeScaledFunction smoothFunc, baseDomainEnd, properties.domain
	properties.domain.sort()

	###copy properties###
	smoothFunc[k] = v for own k,v of properties
