module Math
#直边
def self.tri_side(l1, l2)
return (Math.sqrt(l2 ** 2 - l1 ** 2) + 0.5).to_i
end
#余
def self.cos_a(angle)
return Math.cos(angle*(Math::PI/180))
end
#正
def self.sin_a(angle)
return Math.sin(angle*(Math::PI/180))
end
#x轴翻转
def self.dir_value(n1, n2)
return ((n1 + n2).abs != (n1.abs + n2.abs) ? -1 : 1)
end
#圆相交
def self.collision?(x1,y1,x2,y2,r)
if (x1 - x2) **2 + (y1 - y2) **2 <= r ** 2
return true
end
return false
end
end
module Math
#直边
def self.tri_side(l1, l2)
return (Math.sqrt(l2 ** 2 - l1 ** 2) + 0.5).to_i
end
#余
def self.cos_a(angle)
return Math.cos(angle*(Math::PI/180))
end
#正
def self.sin_a(angle)
return Math.sin(angle*(Math::PI/180))
end
#x轴翻转
def self.dir_value(n1, n2)
return ((n1 + n2).abs != (n1.abs + n2.abs) ? -1 : 1)
end
#圆相交
def self.collision?(x1,y1,x2,y2,r)
if (x1 - x2) **2 + (y1 - y2) **2 <= r ** 2
return true
end
return false
end
end
module Math
#直边
def self.tri_side(l1, l2)
return (Math.sqrt(l2 ** 2 - l1 ** 2) + 0.5).to_i
end
#余
def self.cos_a(angle)
return Math.cos(angle*(Math::PI/180))
end
#正
def self.sin_a(angle)
return Math.sin(angle*(Math::PI/180))
end
#x轴翻转
def self.dir_value(n1, n2)
return ((n1 + n2).abs != (n1.abs + n2.abs) ? -1 : 1)
end
#圆相交
def self.collision?(x1,y1,x2,y2,r)
if (x1 - x2) **2 + (y1 - y2) **2 <= r ** 2
return true
end
return false
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |