Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(223)  |  Call(201)  |  Derive(0)  |  Import(22)

src/p/y/pypybox2d-2.1-r331/pypybox2d/shapes.py   pypybox2d(Download)
import operator
from copy import copy
from .common import (PI, NUMBER_TYPES, Vec2, AABB, Transform, 
                     min_vector, max_vector, property)
from .settings import (EPSILON, EPSILON_SQR, POLYGON_RADIUS)
    def __init__(self, mass=0.0, center=(0,0), I=0.0):
        self.mass=mass
        self.center=Vec2(*center)
        self.I=I
 
    def __init__(self, radius=0.2, position=(0,0)):
        self.position=Vec2(*position)
        self.radius=radius
        # TODO radius should be _radius, position also:
        #  and add properties
 
        # Solve quadratic equation.
        r = Vec2(*p2) - p1
        c =  s * r
        rr = r * r
    def __init__(self, vertices=None, box=None):
        self.radius=POLYGON_RADIUS
        self._vertices=[]
        self._normals=[]
        self._centroid=Vec2()

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/revolute.py   pypybox2d(Download)
# $Source$
 
from ..common import (Vec2, Vec3, Mat22, Mat33, scalar_cross, clamp, property)
from ..settings import (LINEAR_SLOP, ANGULAR_SLOP, MAX_ANGULAR_CORRECTION)
from .joint import (INACTIVE_LIMIT, AT_LOWER_LIMIT, AT_UPPER_LIMIT, EQUAL_LIMITS)
 
        if local_anchor_a is not None:
            self._local_anchor_a = Vec2(*local_anchor_a)
        else:
            self._local_anchor_a = body_a.get_local_point(anchor)
 
        if local_anchor_b is not None:
            self._local_anchor_b = Vec2(*local_anchor_b)
    def local_anchor_a(self):
        """The local anchor point relative to body_a's origin."""
        return Vec2(*self._local_anchor_a)
 
    @property
    def local_anchor_b(self):
        """The local anchor point relative to body_b's origin."""
        return Vec2(*self._local_anchor_b)

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/weld.py   pypybox2d(Download)
# $Source$
 
from ..common import (Vec2, Vec3, Mat22, Mat33, scalar_cross, property)
from ..settings import (LINEAR_SLOP, ANGULAR_SLOP)
from .joint import Joint
            self._local_anchor_b = body_b.get_local_point(anchor)
        else:
            self._local_anchor_a = Vec2(*local_anchor_a)
            self._local_anchor_b = Vec2(*local_anchor_b)
 
    def get_reaction_force(self, inv_dt):
        """Get the reaction force on body_b at the joint anchor in Newtons."""
        return inv_dt * Vec2(self._impulse.x, self._impulse.y)
 
    def get_reaction_torque(self, inv_dt):
 
            ix, iy, iz = self._impulse
            P = Vec2(ix, iy)
 
            va -= ma * P

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/prismatic.py   pypybox2d(Download)
# $Source$
 
from ..common import (Vec2, Vec3, Mat22, Mat33, scalar_cross, clamp, property)
from ..settings import (LINEAR_SLOP, ANGULAR_SLOP, MAX_LINEAR_CORRECTION)
from .joint import (INACTIVE_LIMIT, AT_LOWER_LIMIT, AT_UPPER_LIMIT, EQUAL_LIMITS)
        Joint.__init__(self, body_a, body_b, collide_connected)
        if local_anchor_a is not None:
            self._local_anchor_a = Vec2(*local_anchor_a)
        else:
            self._local_anchor_a = body_a.get_local_point(anchor)
 
        if local_anchor_b is not None:
            self._local_anchor_b = Vec2(*local_anchor_b)
 
        if local_x_axis is not None:
            self._local_x_axis = Vec2(*local_x_axis)
        else:
            self._local_x_axis = body_a.get_local_vector(axis)
 
        self._local_y_axis = scalar_cross(1.0, self._local_x_axis)
        self._motor_mass = 0.0
        self._motor_impulse = 0.0
        self._axis = Vec2()

src/p/y/pypybox2d-2.1-r331/pypybox2d/collision.py   pypybox2d(Download)
# $Source$
 
from .common import (Vec2, distance_squared)
from .collision_util import (max_separation, find_incident_edge, clip_segment_to_line)
from .contact_util import (ManifoldPoint, ClipVertex, Manifold)
 
    manifold.type = Manifold.CIRCLES
    manifold.local_point = Vec2(*circle_a.position)
    manifold.local_normal = Vec2()
    manifold.point_count = 1
 
    point=manifold.points[0]
    point.local_point = Vec2(*circle_b.position)
        manifold.point_count = 1
        manifold.type = Manifold.FACE_A
        manifold.local_normal = Vec2(*normals[normal_index])
        manifold.local_point = 0.5 * (v1 + v2)
        point=manifold.points[0]

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/mouse.py   pypybox2d(Download)
# $Source$
 
from ..common import (PI, Vec2, Mat22, scalar_cross, is_valid_float, property)
from ..settings import EPSILON
from .joint import Joint
    def __init__(self, body, target=(0, 0), max_force = 0.0, frequency=5.0, damping_ratio=0.7):
        if body is None:
            raise ValueError('body must be set')
 
        target = Vec2(*target)
        self._local_anchor_b = body.get_local_point(target)
        self._max_force = max_force
        self._impulse = Vec2()
        self._frequency = frequency
        self._damping_ratio = damping_ratio
        anchor initially.
        """
        return Vec2(*self._target)
 
    @target.setter
    def target(self, target):
        if not self._body_b.awake:
            self._body_b.awake = True
 
        self._target = Vec2(*target)

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/friction.py   pypybox2d(Download)
# $Source$
 
from ..common import (Vec2, Mat22, scalar_cross, clamp, is_valid_float, property)
from .joint import Joint
 
        Joint.__init__(self, body_a, body_b, collide_connected)
 
        self._local_anchor_a = Vec2(*local_anchor_a)
        self._local_anchor_b = Vec2(*local_anchor_b)
        self._linear_impulse = Vec2()
 
        K = Mat22()
        K.col1 = Vec2(inv_mass_a + inv_mass_b + inv_Ia * ra.y * ra.y + inv_Ib * rb.y * rb.y,
                      -inv_Ia * ra.x * ra.y - inv_Ib * rb.x * rb.y)
        K.col2 = Vec2(K.col1.y,

src/p/y/pypybox2d-2.1-r331/pypybox2d/joints/distance.py   pypybox2d(Download)
# $Source$
 
from ..common import (PI, Vec2, Mat22, scalar_cross, clamp, property)
from ..settings import (LINEAR_SLOP, MAX_LINEAR_CORRECTION)
from .joint import Joint
 
        if local_anchor_a is not None:
            self._local_anchor_a = Vec2(*local_anchor_a)
        else:
            self._local_anchor_a = body_a.get_local_point(anchor_a)
 
        if local_anchor_b is not None:
            self._local_anchor_b = Vec2(*local_anchor_b)
        self._gamma = 0.0
        self._bias = 0.0
        self._u = Vec2()
        self._mass = 0.0
 
    def local_anchor_a(self):
        """The local anchor point relative to body_a's origin."""
        return Vec2(*self._local_anchor_a)
 
    @property

src/p/y/pypybox2d-2.1-r331/pypybox2d/contact.py   pypybox2d(Download)
from . import settings
from . import collision
from .common import (Vec2, Mat22, scalar_cross, clamp, Transform, property)
from .contact_util import (mix_friction, mix_restitution, 
                           Manifold, WorldManifold, 
 
            vc.points = vcps
            pc.local_points = [Vec2(*mp.local_point) for mp in manifold.used_points]
 
    def initialize_velocity_constraints(self):
                cp1, cp2 = vc.points[:2]
 
                a = Vec2(cp1.normal_impulse, cp2.normal_impulse)
                assert(a.x >= 0.0 and a.y >= 0.0)
 
                vn2 = dv2.dot(normal)
 
                b = Vec2(vn1 - cp1.velocity_bias, vn2 - cp2.velocity_bias)
                b -= vc.K * a
 
                    """
 
                    x = Vec2(-cp1.normal_mass * b.x, 0.0)
                    vn1 = 0.0
                    vn2 = vc.K.col1.y * x.x + b.y

src/p/y/pypybox2d-2.1-r331/pypybox2d/distance.py   pypybox2d(Download)
 
from copy import copy
from .common import (Vec2, scalar_cross, distance)
from .shapes import (Circle, Polygon, Edge, Loop, Shape)
from .settings import (DISTANCE_MAX_ITERS, EPSILON_SQR, EPSILON)
    def __init__(self, wa=(0,0), wb=(0,0), w=(0,0), a=0.0, index_a=0, index_b=0):
        self.wa = Vec2(*wa)
        self.wb = Vec2(*wb)
        self.w = Vec2(*w)
        self.a = a
            return self._v1.a * self._v1.w + self._v2.a * self._v2.w
        elif self._count == 3:
            return Vec2(0, 0)
        else:
            assert(False)

  1 | 2 | 3  Next