def getHalfCircle(this, num, radius, x, y): if num == 1: return [[x,y]] axe = self.towards(x, y) rayon = radius * (1 - Math.exp(-num/3)) offset = Math.PI / (num-1) points = [] for i in range(num): X = rayon*Math.cos(i*offset+Math.PI/2+axe*Math.PI/180)+x Y = rayon*Math.sin(i*offset+Math.PI/2+axe*Math.PI/180)+y points.append([X,Y]) return points
def getCircle(this, num, radius): if num == 0: return None if num == 1: return [[50,50]] rayon = radius * (1 - Math.exp(-num/3)) offset = 2*Math.PI / num points = [] for i in range(num): X = rayon*Math.cos(i*offset) Y = rayon*Math.sin(i*offset) points.append([X,Y]) return points
def getCircle(this, num, radius): if num == 0: return None if num == 1: return [[50, 50]] rayon = radius * (1 - Math.exp(-num / 3)) offset = 2 * Math.PI / num points = [] for i in range(num): X = rayon * Math.cos(i * offset) Y = rayon * Math.sin(i * offset) points.append([X, Y]) return points
def getHalfCircle(this, num, radius, x, y): if num == 1: return [[x, y]] axe = self.towards(x, y) rayon = radius * (1 - Math.exp(-num / 3)) offset = Math.PI / (num - 1) points = [] for i in range(num): X = rayon * Math.cos(i * offset + Math.PI / 2 + axe * Math.PI / 180) + x Y = rayon * Math.sin(i * offset + Math.PI / 2 + axe * Math.PI / 180) + y points.append([X, Y]) return points
def exp(self, x): import java.lang.Math as Math max_exp = 1e19 return Math.min(max_exp, Math.exp(x))
def exp_fit(x, a, b, c): return a * Math.exp(-b * x) + c