@Tween
--speed:0,0
index,ratio = math.modf(obj.getpoint("index"))
num = obj.getpoint("num")

local x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3
if( index > 0 or obj.getpoint("accelerate") ) then
	x0,y0,z0 = obj.getpoint(index-1,0,3)
else
	x0,y0,z0 = obj.getpoint(0,0,3)
	x1,y1,z1 = obj.getpoint(1,0,3)
	x2,y2,z2 = obj.getpoint(2,0,3)
	x0 = x0+(x0-x1*2+x2)/2
	y0 = y0+(y0-y1*2+y2)/2
	z0 = z0+(z0-z1*2+y2)/2
end
if( index < num-2 or obj.getpoint("decelerate") ) then
	x3,y3,z3 = obj.getpoint(index+2,0,3)
else
	x3,y3,z3 = obj.getpoint(num-1,0,3)
	x2,y2,z2 = obj.getpoint(num-2,0,3)
	x1,y1,z1 = obj.getpoint(num-3,0,3)
	x3 = x3+(x3-x2*2+x1)/2
	y3 = y3+(y3-y2*2+y1)/2
	z3 = z3+(z3-z2*2+y1)/2
end
x1,y1,z1 = obj.getpoint(index  ,0,3)
x2,y2,z2 = obj.getpoint(index+1,0,3)

i,n = obj.getpoint("link")
if( n < 3 ) then
	z0,z1,z2 = 0,0,0;
	if( n < 2 ) then
		y0,y1,y2 = 0,0,0;
	end
end

x0,y0,z0 = obj.interpolation(ratio,x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3)
return x0;

@Rotation
--twopoint
--param:100
index = obj.getpoint("index")
i = obj.getpoint("link")
num = obj.getpoint("param")
if( i == 0 ) then
	x = obj.getpoint(0,0) - obj.getpoint(1,0)
	y = obj.getpoint(0,1) - obj.getpoint(1,1)
	l = math.sqrt(x*x+y*y)
	r = math.atan2(x,-y)
	r = r + math.pi*index*num/50
	return obj.getpoint(1,0) + l*math.sin(r)
elseif( i == 1 ) then
	x = obj.getpoint(0,-1) - obj.getpoint(1,-1)
	y = obj.getpoint(0,0) - obj.getpoint(1,0)
	l = math.sqrt(x*x+y*y)
	r = math.atan2(x,-y)
	r = r + math.pi*index*num/50
	return obj.getpoint(1,0) - l*math.cos(r)
end
return obj.getpoint("default")


