• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1870)  |  Call(1624)  |  Derive(0)  |  Import(246)
atan2(y, x)

Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.

src/h/e/hedge-0.91/examples/maxwell/analytic_solutions.py   hedge(Download)
from hedge.tools import \
        cyl_bessel_j, \
        cyl_bessel_j_prime
from math import sqrt, pi, sin, cos, atan2
import cmath
 
 
    def __call__(self, x, el):
        xy = x[:2]
        r = sqrt(xy*xy)
        phi = atan2(x[1], x[0])
 
        prev_result = self.adaptee(x, el)
        result = []
    def __call__(self, x, el):
        # coordinates -----------------------------------------------------
        xy = x[:2]
        r = sqrt(xy*xy)
        phi = atan2(x[1], x[0])
        z = x[2]
 

src/o/m/omniorb-HEAD/omniORBpy/examples/weather/gauge.py   omniorb(Download)
    def motionhandler(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y) - self.minlocation_r
 
        while a < 0: a = a + 2 * math.pi
 
    def rotatePoint(self, point, theta):
        """Rotate a point clockwise about the origin by an angle in radians"""
 
        x,y = point
        r   = math.sqrt(x*x + y*y)
        a   = math.atan2(y,x) - theta
 
    def motionhandler_h(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y)
 
        while a < 0: a = a + 2 * math.pi
 
    def motionhandler_m(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y)
 
        while a < 0: a = a + 2 * math.pi
 

src/o/m/omniorbpy-HEAD/examples/weather/gauge.py   omniorbpy(Download)
    def motionhandler(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y) - self.minlocation_r
 
        while a < 0: a = a + 2 * math.pi
 
    def rotatePoint(self, point, theta):
        """Rotate a point clockwise about the origin by an angle in radians"""
 
        x,y = point
        r   = math.sqrt(x*x + y*y)
        a   = math.atan2(y,x) - theta
 
    def motionhandler_h(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y)
 
        while a < 0: a = a + 2 * math.pi
 
    def motionhandler_m(self, event):
        x = event.x - self.centre
        y = event.y - self.centre
        a = math.atan2(x,-y)
 
        while a < 0: a = a + 2 * math.pi
 

src/l/a/Langtangen-HEAD/src/py/examples/canvas/model1.py   Langtangen(Download)
        rx = xc - x0;  ry = yc - y0
        self.r = math.sqrt(rx*rx + ry*ry)
        self.x_prev = x0;  self.y_prev = y0
        self.theta_0 = math.atan2(y0-yc, x0-xc)
        self.t = 0
        self.dt = self.omega/self.nsteps_per_round
        # => t=1 after one round

src/p/y/pyx-HEAD/trunk/pyx/www/png/example.py   pyx(Download)
    def midcolor(self, *c):
        return math.atan2(sum([math.sin(x) for x in c]), sum([math.cos(x) for x in c]))
 
g = graph.graphxyz(size=3.5, zscale=0.3, projector=graph.graphxyz.central(3, 25, 8),
                   x=graph.axis.lin(painter=None),
                   y=graph.axis.lin(painter=None),
                   z=graph.axis.lin(painter=None),

src/g/o/googletransitdatafeed-HEAD/python/examples/google_random_queries.py   googletransitdatafeed(Download)
  a = math.sin(dlat*0.5)
  b = math.sin(dlng*0.5)
  a = a * a + math.cos(lat0) * math.cos(lat1) * b * b
  c = 2.0 * math.atan2(math.sqrt(a), math.sqrt(1.0 - a))
  return 6367000.0 * c
 
 

src/p/y/pyx-HEAD/pyx/www/png/example.py   pyx(Download)
    def midcolor(self, *c):
        return math.atan2(sum([math.sin(x) for x in c]), sum([math.cos(x) for x in c]))
 
g = graph.graphxyz(size=3.5, zscale=0.3, projector=graph.graphxyz.central(3, 25, 8),
                   x=graph.axis.lin(painter=None),
                   y=graph.axis.lin(painter=None),
                   z=graph.axis.lin(painter=None),

src/o/w/owyl-0.3/examples/boids.py   owyl(Download)
import os
 
import random
from math import radians, degrees, sin, cos, pi, atan2
pi_2 = pi*2.0
pi_1_2 = pi/2.0
pi_1_4 = pi/4.0
    def getFacing(self, tx, ty):
        """Find the facing rotation to local coordinates tx, ty.
        """
        return -(atan2(ty, tx) - pi_1_2)
 
    @taskmethod
    def move(self, **kwargs):

src/p/y/pyprocessing-0.1.2.3/examples/reference/curvetangent.py   pyprocessing(Download)
from pyprocessing import *
from math import atan2, cos, sin
 
noFill()
curve(5, 26, 73, 24, 73, 61, 15, 65)
steps = 6;
for i in range(steps+1):
  t = i / float(steps);
  x = curvePoint(5, 73, 73, 15, t);
  y = curvePoint(26, 24, 61, 65, t);
  #ellipse(x, y, 5, 5);
  tx = curveTangent(5, 73, 73, 15, t);
  ty = curveTangent(26, 24, 61, 65, t);
  a = atan2(ty, tx);

src/h/e/hedge-0.91/examples/poisson/poisson.py   hedge(Download)
    def boundary_tagger(fvi, el, fn):
        from math import atan2, pi
        normal = el.face_normals[fn]
        if -10/180*pi < atan2(normal[1], normal[0]) < 10/180*pi:
            return ["neumann"]
        else:
            return ["dirichlet"]

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next