예제 #1
0
파일: test2.py 프로젝트: Jintram/egfrd
 def check_overlap(self, sphere, ignores):
     retval = []
     for pp in self.particles.iteritems():
         if pp[0] in ignores:
             continue
         dist = _gfrd.distance(pp[1].position, sphere.position) - pp[1].radius
         if dist < sphere.radius:
             retval.append((pp, dist))
     retval.sort(lambda a, b: cmp(a[1], b[1]))
     return retval
예제 #2
0
파일: test2.py 프로젝트: tjclement/egfrd
 def check_overlap(self, sphere, ignores):
     retval = []
     for pp in self.particles.iteritems():
         if pp[0] in ignores:
             continue
         dist = _gfrd.distance(pp[1].position,
                               sphere.position) - pp[1].radius
         if dist < sphere.radius:
             retval.append((pp, dist))
     retval.sort(lambda a, b: cmp(a[1], b[1]))
     return retval
예제 #3
0
파일: legacy.py 프로젝트: TheJoris/egfrd
    def check_overlap(self, sphere, *arg):
        if len(arg) == 0:
            ignores = ()
        elif len(arg) == 1:
            if isinstance(arg[0], _gfrd.ParticleID):
                ignores = (arg[0],)
            else:
                ignores = arg[0]
        elif len(arg) == 2:
            assert all(isinstance(a, _gfrd.ParticleID) for a in arg)
            ignores = arg

        retval = []
        for pp in self.particles.iteritems():
            if pp[0] in ignores:
                continue
            dist = _gfrd.distance(pp[1].position, sphere[0]) - pp[1].radius
            if dist < sphere[1]:
                retval.append((pp, dist))
        retval.sort(lambda a, b: cmp(a[1], b[1]))
        return retval
예제 #4
0
파일: legacy.py 프로젝트: TheOtherOne/egfrd
    def check_overlap(self, sphere, *arg):
        if len(arg) == 0:
            ignores = ()
        elif len(arg) == 1:
            if isinstance(arg[0], _gfrd.ParticleID):
                ignores = (arg[0], )
            else:
                ignores = arg[0]
        elif len(arg) == 2:
            assert all(isinstance(a, _gfrd.ParticleID) for a in arg)
            ignores = arg

        retval = []
        for pp in self.particles.iteritems():
            if pp[0] in ignores:
                continue
            dist = _gfrd.distance(pp[1].position, sphere[0]) - pp[1].radius
            if dist < sphere[1]:
                retval.append((pp, dist))
        retval.sort(lambda a, b: cmp(a[1], b[1]))
        return retval
예제 #5
0
파일: utils.py 프로젝트: gfrd/gfrd
def length( a ):
    #return math.sqrt( numpy.dot( a, a ) )
    return _gfrd.distance( ZEROPOS, a )
예제 #6
0
파일: utils.py 프로젝트: gfrd/gfrd
def randomVector( r ):
    v = numpy.random.uniform( -1, 1, 3 )
    return v * ( r / _gfrd.distance( ZEROPOS, v ) )
예제 #7
0
파일: utils.py 프로젝트: gfrd/gfrd
def randomUnitVector():
    v = numpy.random.uniform( -1, 1, 3 )
    return v / _gfrd.distance( ZEROPOS, v )
예제 #8
0
파일: utils.py 프로젝트: gfrd/gfrd
def distance_Simple( position1, position2, fsize = 0 ):
    return _gfrd.distance( position1, position2 )