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

All Samples(1787)  |  Call(1617)  |  Derive(0)  |  Import(170)
radians(x)

Convert angle x from degrees to radians.

src/p/y/pyx-HEAD/trunk/pyx/examples/drawing2/insert.py   pyx(Download)
from math import sin, cos, radians
from pyx import *
 
angle = 10
factor = 1.0 / (cos(radians(angle)) + sin(radians(angle)))
 
cc = canvas.canvas()

src/p/y/pyx-HEAD/pyx/examples/drawing2/insert.py   pyx(Download)
from math import sin, cos, radians
from pyx import *
 
angle = 10
factor = 1.0 / (cos(radians(angle)) + sin(radians(angle)))
 
cc = canvas.canvas()

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 move(self, **kwargs):
        """Move the actor forward perpetually.
        """
        bb = kwargs['blackboard']
        while True:
            dt = bb['dt']
            r = radians(getR(self)) # rotation
            dx = gx-self.x
            dy = gy-self.y
            seek_heading = self.getFacing(dx, dy)
            my_heading = radians(self.rotation)
 
            rsize = degrees(self.findRotationDelta(my_heading, seek_heading))
 
        rate = kwargs['rate']
        while True:
            dt = bb['dt'] or 0.01
            n_heading = radians(self.findAverageHeading(*self.neighbors))
            if n_heading is None:
                yield None
                continue
            my_heading = radians(self.rotation)
 
            heading_away_from_neighbors = self.getFacing(dx, dy)
            flee_heading = heading_away_from_neighbors
            my_heading = radians(self.rotation)
 
            rsize = degrees(self.findRotationDelta(my_heading, flee_heading))
 
            dx = np_x-self.x
            dy = np_y-self.y
            seek_heading = self.getFacing(dx, dy)
            my_heading = radians(self.rotation)
 
            # Find the rotation delta
            rsize = degrees(self.findRotationDelta(my_heading, seek_heading))

src/r/a/Rabbyt-0.8.3/examples/driving.py   Rabbyt(Download)
from __future__ import division
 
import pygame
import rabbyt
 
from math import cos, sin, radians
import random
        a = [0.0,0.0]
        if self.boost_endtime > rabbyt.get_time():
            f = 3*(self.boost_endtime - rabbyt.get_time())/self.boost_length
            a[0] += cos(radians(self.boost_rot))*f
            a[1] += sin(radians(self.boost_rot))*f
            self.create_boost_particle()
 
        if self.accelerating:
            a[0] += cos(radians(self.rot))*.9
            a[1] += sin(radians(self.rot))*.9

src/p/y/PyMT-0.5.1/examples/framework/animation/animation_functions.py   PyMT(Download)
def on_press(*largs):
    anim_list = []
    for i in range(64):
        teta = math.radians(8*i)
        x = 200 * math.cos(teta)+w.width/2
        y = 200 * math.sin(teta)+w.height/2
        anim_list.append(Animation(duration=1.5, pos=(x,y), alpha_function="ease_in_out_back"))
def on_press(*largs):
    anim_list = []
    for i in range(64):
        teta = math.radians(8*i)
        x = 200 * math.cos(teta)+w.width/2
        y = 200 * math.sin(teta*2)+w.height/2
        anim_list.append(Animation(duration=1.5, pos=(x,y), alpha_function="ease_in_out_back"))

src/g/r/grease-0.2/examples/blasteroids3.py   grease(Download)
        load_sound('hit3.wav'),
    ]
 
    UNIT_CIRCLE = [(math.sin(math.radians(a)), math.cos(math.radians(a))) 
        for a in range(0, 360, 18)]
 
    def __init__(self, world, radius=45, position=None, parent_velocity=None, points=25):

src/g/r/grease-0.2/examples/blasteroids2.py   grease(Download)
class Asteroid(BlasteroidsEntity):
    """Big floating space rock"""
 
    COLLIDE_INTO_MASK = 0x2
    UNIT_CIRCLE = [(math.sin(math.radians(a)), math.cos(math.radians(a))) 
        for a in range(0, 360, 18)]
 

src/g/r/grease-0.2/examples/blasteroids1.py   grease(Download)
class Asteroid(grease.Entity):
    """Big floating space rock"""
 
    UNIT_CIRCLE = [(math.sin(math.radians(a)), math.cos(math.radians(a))) 
        for a in range(0, 360, 18)]
 
    def __init__(self, world, radius=45):

src/p/y/pyobjc-framework-Quartz-2.3/Examples/Core Graphics/CGShading Demo/MyQuartzView.py   pyobjc-framework-Quartz(Download)
        if (getShading == getRadialShading):
            CGContextAddArc(currentContext, 
                    startPoint.x, startPoint.y, startRadius,
                    math.radians(0), math.radians(360), True)
            CGContextClosePath(currentContext)
            CGContextMoveToPoint(currentContext, endPoint.x + endRadius, endPoint.y)
            CGContextAddArc(currentContext, endPoint.x, endPoint.y, endRadius,
                        math.radians(0), math.radians(360), True)
            CGContextClosePath(currentContext)
 
        CGContextMoveToPoint(currentContext, startPoint.x + 0.01, startPoint.y)
        CGContextAddArc(currentContext, startPoint.x, startPoint.y, 0.01,
                    math.radians(0), math.radians(360), True)

src/o/d/odfpy-0.9.2/examples/europeanflag-as-odt.py   odfpy(Download)
    def forward(self, length):
        orirad = math.radians(self.orientation)
        self.x = self.x + length * math.cos(orirad)
        self.y = self.y + length * math.sin(orirad)
 
    def right(self, turn):
        self.orientation = (self.orientation + turn) % 360
 
# Go around in a circle in twelve steps
for deg in range(0,360,30):
    x = 83.3 + math.cos(math.radians(deg)) * 40
    y = 53.3 + math.sin(math.radians(deg)) * 40
    group.addElement(Polygon(points=points,
       stylename=starstyle, viewbox=viewbox, width="13.3mm", height="13.3mm", x="%0.2fmm" % x, y="%0.2fmm" % y))

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