def Calculate(graph, nodeIndex1, nodeIndex2):
     return Vector2D.Vec2DDistanceSq(
         graph.GetNode(nodeIndex1).Position,
         graph.GetNode(nodeIndex2).Position) * uniform(0.9, 1.1)
Beispiel #2
0
    def test_SpecifyThatTheDistanceSquaredBetweenTwoVectorsCanBeCalculatedUsingAStaticMethod(
            self):
        v1 = Vector2D(1, 0)
        v2 = Vector2D(1, 3)

        self.assertAlmostEqual(9.0, Vector2D.Vec2DDistanceSq(v1, v2), places=3)
Beispiel #3
0
 def IsTouching(self, entityPosition, entityRadius):
     return Vector2D.Vec2DDistanceSq(self._position, entityPosition) < \
            (entityRadius + self._radius) * (entityRadius + self._radius)