function SpringClass.new(g,S,K,o)local U=setmetatable({},SpringClass)U.instant=false U.marginOfError=1e-06 K=K or 1 local s=(S*S)/(((4*g)*K)*K)U.k=g/s U.d=-S/s U.x=o U.t=o U.v=o*0 return U end


function SpringClass.new(stiffness, dampingCoeff, dampingRatio, initialPos)
	local self = setmetatable({}, SpringClass)
	
	self.instant = false
	self.marginOfError = 1E-6

	dampingRatio = dampingRatio or 1
	local m = dampingCoeff*dampingCoeff/(4*stiffness*dampingRatio*dampingRatio)
	self.k = stiffness/m
	self.d = -dampingCoeff/m
	self.x = initialPos
	self.t = initialPos
	self.v = initialPos*0

	return self
end
