Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.su/trac/tanchiki/changeset/29
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Sun Apr 10 02:16:49 2016
Êîäèðîâêà: IBM-866
Changeset 29:779e091fb740 òÀÓ Tanchiki

Changeset 29:779e091fb740


Ignore:
Timestamp:
12/20/10 11:36:35 (5 years ago)
Author:
Peter Zotov <whitequark@òÀæ>
Branch:
default
Message:

Make Vector.null back.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tanchiki/vector.py

    r28 r29 ˆà
    11import mathˆà
    22ˆà
    3ˆàclass Vector(object):   ˆà
    4ˆàˆà
    5ˆà        def __init__(self, x=0 , y=0):         ˆà
    ˆà3class Vector(object):ˆà
    ˆà4        def __init__(self, x=0 , y=0):ˆà
    65                self.x = xˆà
    76                self.y = yˆà
    87        ˆà
    98        def __add__(self, other):ˆà
    10ˆà                result = Vector(0,0)ˆà
    ˆà9                result = Vector(0, 0)ˆà
    1110                result.x = self.x + other.xˆà
    1211                result.y = self.y + other.yˆà
    òÀæ òÀæ ˆà
    2019ˆà
    2120        def dot_product(self, other):ˆà
    22ˆà                return  self.x*other.x + self.y*other.y ˆà
    ˆà21                return  self.x*other.x + self.y*other.yˆà
    2322ˆà
    2423        def __abs__(self):ˆà
    òÀæ òÀæ ˆà
    5049                        self.x , self.y = self.x*(new_rho/abs(self)) , self.y*(new_rho/abs(self))ˆà
    5150ˆà
    52ˆà        rho = property(get_rho, set_rho) ˆà
    ˆà51        rho = property(get_rho, set_rho)ˆà
    5352ˆà
    5453        def get_phi(self):ˆà
    òÀæ òÀæ ˆà
    6362ˆà
    6463        phi = property(get_phi, set_phi)ˆà
    ˆà64ˆà
    ˆà65Vector.null = Vector(0, 0)ˆà
Note: See TracChangeset for help on using the changeset viewer.