コード例 #1
0
ファイル: test_collapse.py プロジェクト: bmmeijers/grassfire
    def test_bump(self):
        """2 vertices that bump into each other half way"""
        u = KineticVertex()
        u.origin = (0., 0.)
        u.velocity = (1., 1.)

        v = KineticVertex()
        v.origin = (10., 10.)
        v.velocity = (-1., -1.)
        time = collapse_time_edge(u, v)
        assert time is not None
        dist = u.distance2_at(v, time)
        assert near_zero(dist)
コード例 #2
0
ファイル: test_collapse.py プロジェクト: bmmeijers/grassfire
    def test_crossing(self):
        """2 vertices crossing each other"""
        u = KineticVertex()
        u.origin = (0., 0.)
        u.velocity = (1., 1.)

        v = KineticVertex()
        v.origin = (10., 0.)
        v.velocity = (-1., 1.)
        time = collapse_time_edge(u, v)
        #         with open("/tmp/cpa.csv","w") as fh:
        #             for i, inc in enumerate(range(100, 150), start=1):
        #                 val = inc / 1000.
        #                 u.position_at(val)
        #                 v.position_at(val)
        #                 print >>fh, val,";", sqrt(u.distance2_at(v, val))
        dist = u.distance2_at(v, time)
        assert near_zero(dist)