# Copyright (C) 2021 Open Source Robotics Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest
import math
from ignition.math import Vector2d
from ignition.math import Vector2f


class TestVector2(unittest.TestCase):

    def test_construction(self):
        v = Vector2d()
        self.assertAlmostEqual(0.0, v.x())
        self.assertAlmostEqual(0.0, v.y())

        vec = Vector2d(1, 0)
        self.assertEqual(vec.x(), 1)
        self.assertEqual(vec.y(), 0)

        vec2 = Vector2d(vec)
        self.assertEqual(vec2, vec)

        # Copy
        vec3 = vec
        self.assertEqual(vec3, vec)

        # Inequality
        vec4 = Vector2d()
        self.assertNotEqual(vec, vec4)

    def test_vector2(self):
        v = Vector2d(1, 2)

        # Distance
        self.assertAlmostEqual(2.236, v.distance(Vector2d()), delta=1e-2)

        # Normalize
        v.normalize()
        self.assertTrue(v.equal(Vector2d(0.447214, 0.894427), 1e-4))

        # Set
        v.set(4, 5)
        self.assertTrue(v.equal(Vector2d(4, 5), 1e-4))

        # Abs
        v.set(-1, -2)
        self.assertTrue(v.abs().equal(Vector2d(1, 2), 1e-4))

        # _eq_
        v = Vector2d(6, 7)
        self.assertTrue(v.equal(Vector2d(6, 7), 1e-4))

        # _add_
        v = v + Vector2d(1, 2)
        self.assertTrue(v.equal(Vector2d(7, 9), 1e-4))

        v += Vector2d(5, 6)
        self.assertTrue(v.equal(Vector2d(12, 15), 1e-4))

        # __sub__
        v = v - Vector2d(2, 4)
        self.assertTrue(v.equal(Vector2d(10, 11), 1e-4))

        v.set(2, 4)
        v -= Vector2d(1, 6)
        self.assertTrue(v.equal(Vector2d(1, -2), 1e-4))

        # __truediv__
        v.set(10, 6)
        v = v / Vector2d(2, 3)
        self.assertTrue(v.equal(Vector2d(5, 2), 1e-4))

        v.set(10, 6)
        v /= Vector2d(2, 3)
        self.assertTrue(v.equal(Vector2d(5, 2), 1e-4))

        # __truediv__ int
        v.set(10, 6)
        v = v / 2
        self.assertTrue(v.equal(Vector2d(5, 3), 1e-4))

        v.set(10, 6)
        v /= 2
        self.assertTrue(v.equal(Vector2d(5, 3), 1e-4))

        # __mul__
        v.set(10, 6)
        v = v * Vector2d(2, 4)
        self.assertTrue(v.equal(Vector2d(20, 24), 1e-4))

        v.set(10, 6)
        v *= Vector2d(2, 4)
        self.assertTrue(v.equal(Vector2d(20, 24), 1e-4))

        # __mul__ int
        v.set(10, 6)
        v = v * 2
        self.assertTrue(v.equal(Vector2d(20, 12), 1e-4))

        v.set(10, 6)
        v *= 2
        self.assertTrue(v.equal(Vector2d(20, 12), 1e-4))

        # is_finite
        self.assertTrue(v.is_finite())

    def test_max(self):
        vec1 = Vector2d(0.1, 0.2)
        vec2 = Vector2d(0.3, 0.5)
        vec3 = Vector2d(0.4, 0.2)

        self.assertAlmostEqual(vec1.max(), 0.2)
        self.assertAlmostEqual(vec3.max(), 0.4)

        vec1.max(vec2)
        self.assertAlmostEqual(vec1, Vector2d(0.3, 0.5))

        vec1.max(vec3)
        self.assertAlmostEqual(vec1, Vector2d(0.4, 0.5))

    def test_min(self):
        vec1 = Vector2d(0.3, 0.5)
        vec2 = Vector2d(0.1, 0.2)
        vec3 = Vector2d(0.05, 0.1)

        self.assertAlmostEqual(vec1.min(), 0.3)
        self.assertAlmostEqual(vec3.min(), 0.05)

        vec1.min(vec2)
        self.assertAlmostEqual(vec1, Vector2d(0.1, 0.2))

        vec1.min(vec3)
        self.assertAlmostEqual(vec1, Vector2d(0.05, 0.1))

    def test_equal_tolerance(self):
        # Test Equal function with specified tolerance
        self.assertFalse(Vector2d.ZERO.equal(Vector2d.ONE, 1e-6))
        self.assertFalse(Vector2d.ZERO.equal(Vector2d.ONE, 1e-3))
        self.assertFalse(Vector2d.ZERO.equal(Vector2d.ONE, 1e-1))
        self.assertTrue(Vector2d.ZERO.equal(Vector2d.ONE, 1))
        self.assertTrue(Vector2d.ZERO.equal(Vector2d.ONE, 1.1))

    def test_dot(self):
        v = Vector2d(1, 2)
        self.assertAlmostEqual(v.dot(Vector2d(3, 4)), 11.0)
        self.assertAlmostEqual(v.dot(Vector2d(0, 0)), 0.0)
        self.assertAlmostEqual(v.dot(Vector2d(1, 0)), 1.0)
        self.assertAlmostEqual(v.dot(Vector2d(0, 1)), 2.0)

    def test_correct(self):
        vec1 = Vector2d(0, float("nan"))
        vec2 = Vector2d(float("inf"), -1)
        vec3 = Vector2d(10, -2)

        vec1.correct()
        vec2.correct()
        vec3.correct()

        self.assertAlmostEqual(vec1, Vector2d(0, 0))
        self.assertAlmostEqual(vec2, Vector2d(0, -1))
        self.assertAlmostEqual(vec3, Vector2d(10, -2))

    def test_abs_dot(self):
        v = Vector2d(1, -2)

        self.assertAlmostEqual(v.abs_dot(Vector2d(3, 4)), 11.0)
        self.assertAlmostEqual(v.abs_dot(Vector2d(0, 0)), 0.0)
        self.assertAlmostEqual(v.abs_dot(Vector2d(1, 0)), 1.0)
        self.assertAlmostEqual(v.abs_dot(Vector2d(0, 1)), 2.0)

    def test_add(self):
        vec1 = Vector2d(0.1, 0.2)
        vec2 = Vector2d(1.1, 2.2)

        vec3 = vec1
        vec3 += vec2

        self.assertAlmostEqual(vec1 + vec2, Vector2d(1.2, 2.4))
        self.assertAlmostEqual(vec3, Vector2d(1.2, 2.4))

        # Add zero
        # Scalar right
        self.assertEqual(vec1 + 0, vec1)

        # Vector left and right
        self.assertAlmostEqual(Vector2d.ZERO + vec1, vec1)
        self.assertAlmostEqual(vec1 + Vector2d.ZERO, vec1)

        # Addition assigment
        vec4 = Vector2d(vec1)
        vec4 += 0
        self.assertEqual(vec4, vec1)
        vec4 += Vector2d.ZERO
        self.assertAlmostEqual(vec4, vec1)

        # Add non-trivial scalar values left and right
        self.assertEqual(vec1 + 2.5, Vector2d(2.6, 2.7))

        vec1 = vec4
        vec4 += 2.5
        self.assertEqual(vec4, Vector2d(2.6, 2.7))

    def test_sub(self):
        vec1 = Vector2d(0.1, 0.2)
        vec2 = Vector2d(1.1, 2.2)

        vec3 = vec2
        vec3 -= vec1

        self.assertAlmostEqual(vec2 - vec1, Vector2d(1.0, 2.0))
        self.assertAlmostEqual(vec3, Vector2d(1.0, 2.0))

        # Subtraction with zeros
        # Scalar right
        self.assertEqual(vec1 - 0, vec1)

        # Vector left and right
        self.assertAlmostEqual(Vector2d.ZERO - vec1, -vec1)
        self.assertAlmostEqual(vec1 - Vector2d.ZERO, vec1)

        # Subtraction assignment
        vec4 = Vector2d(vec1)
        vec4 -= 0
        self.assertEqual(vec4, vec1)
        vec4 -= Vector2d.ZERO
        self.assertAlmostEqual(vec4, vec1)

        # Subtract non-trivial scalar values left and right
        self.assertEqual(vec1 - 2.5, -Vector2d(2.4, 2.3))

        vec4 = vec1
        vec4 -= 2.5
        self.assertEqual(vec4, -Vector2d(2.4, 2.3))

    def test_multiply(self):
        v = Vector2d(0.1, -4.2)

        vec2 = v * 2.0
        self.assertEqual(vec2, Vector2d(0.2, -8.4))

        vec2 *= 4.0
        self.assertEqual(vec2, Vector2d(0.8, -33.6))

        # Multiply by zero
        # Scalar right
        self.assertEqual(v * 0, Vector2d.ZERO)

        # Element-wise vector multiplication
        self.assertEqual(v * Vector2d.ZERO, Vector2d.ZERO)

        # Multiply by one
        # Scalar right
        self.assertEqual(v * 1, v)

        # Element-wise vector multiplication
        self.assertEqual(v * Vector2d.ONE, v)

        # Multiply by non-trivial scalar value
        scalar = 2.5
        expect = Vector2d(0.25, -10.5)
        self.assertEqual(v * scalar, expect)

        # Multiply by itself element-wise
        v.set(0.1, 0.5)
        self.assertAlmostEqual(v * v, Vector2d(0.01, 0.25))

    def test_lenght(self):
        # Zero vector
        self.assertAlmostEqual(Vector2d.ZERO.length(), 0.0)
        self.assertAlmostEqual(Vector2d.ZERO.squared_length(), 0.0)

        # One vector
        self.assertAlmostEqual(Vector2d.ONE.length(),
                               math.sqrt(2), delta=1e-10)
        self.assertAlmostEqual(Vector2d.ONE.squared_length(), 2.0)

        # Arbitrary vector
        v = Vector2d(0.1, -4.2)
        self.assertAlmostEqual(v.length(), 4.20119030752, delta=1e-10)
        self.assertAlmostEqual(v.squared_length(), 17.65)

        # Integer vector
        v = Vector2d(3, 4)
        self.assertAlmostEqual(v.length(), 5)
        self.assertAlmostEqual(v.squared_length(), 25)

    def test_nan(self):
        nanVec = Vector2d.NAN
        self.assertFalse(nanVec.is_finite())
        self.assertTrue(math.isnan(nanVec.x()))
        self.assertTrue(math.isnan(nanVec.y()))

        nanVec.correct()
        self.assertEqual(Vector2d.ZERO, nanVec)
        self.assertTrue(nanVec.is_finite())

        nanVecF = Vector2f.NAN
        self.assertFalse(nanVecF.is_finite())
        self.assertTrue(math.isnan(nanVecF.x()))
        self.assertTrue(math.isnan(nanVecF.y()))

        nanVecF.correct()
        self.assertEqual(Vector2f.ZERO, nanVecF)
        self.assertTrue(nanVecF.is_finite())

if __name__ == '__main__':
    unittest.main()

[((319, 4, 319, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((24, 12, 24, 22), 'ignition.math.Vector2d', 'Vector2d', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((28, 14, 28, 28), 'ignition.math.Vector2d', 'Vector2d', ({(28, 23, 28, 24): '1', (28, 26, 28, 27): '0'}, {}), '(1, 0)', False, 'from ignition.math import Vector2d\n'), ((32, 15, 32, 28), 'ignition.math.Vector2d', 'Vector2d', ({(32, 24, 32, 27): 'vec'}, {}), '(vec)', False, 'from ignition.math import Vector2d\n'), ((40, 15, 40, 25), 'ignition.math.Vector2d', 'Vector2d', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((44, 12, 44, 26), 'ignition.math.Vector2d', 'Vector2d', ({(44, 21, 44, 22): '1', (44, 24, 44, 25): '2'}, {}), '(1, 2)', False, 'from ignition.math import Vector2d\n'), ((62, 12, 62, 26), 'ignition.math.Vector2d', 'Vector2d', ({(62, 21, 62, 22): '6', (62, 24, 62, 25): '7'}, {}), '(6, 7)', False, 'from ignition.math import Vector2d\n'), ((69, 13, 69, 27), 'ignition.math.Vector2d', 'Vector2d', ({(69, 22, 69, 23): '(5)', (69, 25, 69, 26): '(6)'}, {}), '(5, 6)', False, 'from ignition.math import Vector2d\n'), ((77, 13, 77, 27), 'ignition.math.Vector2d', 'Vector2d', ({(77, 22, 77, 23): '(1)', (77, 25, 77, 26): '(6)'}, {}), '(1, 6)', False, 'from ignition.math import Vector2d\n'), ((86, 13, 86, 27), 'ignition.math.Vector2d', 'Vector2d', ({(86, 22, 86, 23): '(2)', (86, 25, 86, 26): '(3)'}, {}), '(2, 3)', False, 'from ignition.math import Vector2d\n'), ((104, 13, 104, 27), 'ignition.math.Vector2d', 'Vector2d', ({(104, 22, 104, 23): '(2)', (104, 25, 104, 26): '(4)'}, {}), '(2, 4)', False, 'from ignition.math import Vector2d\n'), ((120, 15, 120, 33), 'ignition.math.Vector2d', 'Vector2d', ({(120, 24, 120, 27): '0.1', (120, 29, 120, 32): '0.2'}, {}), '(0.1, 0.2)', False, 'from ignition.math import Vector2d\n'), ((121, 15, 121, 33), 'ignition.math.Vector2d', 'Vector2d', ({(121, 24, 121, 27): '0.3', (121, 29, 121, 32): '0.5'}, {}), '(0.3, 0.5)', False, 'from ignition.math import Vector2d\n'), ((122, 15, 122, 33), 'ignition.math.Vector2d', 'Vector2d', ({(122, 24, 122, 27): '0.4', (122, 29, 122, 32): '0.2'}, {}), '(0.4, 0.2)', False, 'from ignition.math import Vector2d\n'), ((134, 15, 134, 33), 'ignition.math.Vector2d', 'Vector2d', ({(134, 24, 134, 27): '0.3', (134, 29, 134, 32): '0.5'}, {}), '(0.3, 0.5)', False, 'from ignition.math import Vector2d\n'), ((135, 15, 135, 33), 'ignition.math.Vector2d', 'Vector2d', ({(135, 24, 135, 27): '0.1', (135, 29, 135, 32): '0.2'}, {}), '(0.1, 0.2)', False, 'from ignition.math import Vector2d\n'), ((136, 15, 136, 34), 'ignition.math.Vector2d', 'Vector2d', ({(136, 24, 136, 28): '0.05', (136, 30, 136, 33): '0.1'}, {}), '(0.05, 0.1)', False, 'from ignition.math import Vector2d\n'), ((156, 12, 156, 26), 'ignition.math.Vector2d', 'Vector2d', ({(156, 21, 156, 22): '1', (156, 24, 156, 25): '2'}, {}), '(1, 2)', False, 'from ignition.math import Vector2d\n'), ((165, 15, 165, 31), 'ignition.math.Vector2d', 'Vector2d', ({(165, 24, 165, 26): '10', (165, 28, 165, 30): '-2'}, {}), '(10, -2)', False, 'from ignition.math import Vector2d\n'), ((176, 12, 176, 27), 'ignition.math.Vector2d', 'Vector2d', ({(176, 21, 176, 22): '1', (176, 24, 176, 26): '-2'}, {}), '(1, -2)', False, 'from ignition.math import Vector2d\n'), ((184, 15, 184, 33), 'ignition.math.Vector2d', 'Vector2d', ({(184, 24, 184, 27): '0.1', (184, 29, 184, 32): '0.2'}, {}), '(0.1, 0.2)', False, 'from ignition.math import Vector2d\n'), ((185, 15, 185, 33), 'ignition.math.Vector2d', 'Vector2d', ({(185, 24, 185, 27): '1.1', (185, 29, 185, 32): '2.2'}, {}), '(1.1, 2.2)', False, 'from ignition.math import Vector2d\n'), ((202, 15, 202, 29), 'ignition.math.Vector2d', 'Vector2d', ({(202, 24, 202, 28): 'vec1'}, {}), '(vec1)', False, 'from ignition.math import Vector2d\n'), ((216, 15, 216, 33), 'ignition.math.Vector2d', 'Vector2d', ({(216, 24, 216, 27): '0.1', (216, 29, 216, 32): '0.2'}, {}), '(0.1, 0.2)', False, 'from ignition.math import Vector2d\n'), ((217, 15, 217, 33), 'ignition.math.Vector2d', 'Vector2d', ({(217, 24, 217, 27): '1.1', (217, 29, 217, 32): '2.2'}, {}), '(1.1, 2.2)', False, 'from ignition.math import Vector2d\n'), ((234, 15, 234, 29), 'ignition.math.Vector2d', 'Vector2d', ({(234, 24, 234, 28): 'vec1'}, {}), '(vec1)', False, 'from ignition.math import Vector2d\n'), ((248, 12, 248, 31), 'ignition.math.Vector2d', 'Vector2d', ({(248, 21, 248, 24): '0.1', (248, 26, 248, 30): '-4.2'}, {}), '(0.1, -4.2)', False, 'from ignition.math import Vector2d\n'), ((272, 17, 272, 38), 'ignition.math.Vector2d', 'Vector2d', ({(272, 26, 272, 30): '0.25', (272, 32, 272, 37): '-10.5'}, {}), '(0.25, -10.5)', False, 'from ignition.math import Vector2d\n'), ((290, 12, 290, 31), 'ignition.math.Vector2d', 'Vector2d', ({(290, 21, 290, 24): '0.1', (290, 26, 290, 30): '-4.2'}, {}), '(0.1, -4.2)', False, 'from ignition.math import Vector2d\n'), ((295, 12, 295, 26), 'ignition.math.Vector2d', 'Vector2d', ({(295, 21, 295, 22): '3', (295, 24, 295, 25): '4'}, {}), '(3, 4)', False, 'from ignition.math import Vector2d\n'), ((66, 16, 66, 30), 'ignition.math.Vector2d', 'Vector2d', ({(66, 25, 66, 26): '(1)', (66, 28, 66, 29): '(2)'}, {}), '(1, 2)', False, 'from ignition.math import Vector2d\n'), ((73, 16, 73, 30), 'ignition.math.Vector2d', 'Vector2d', ({(73, 25, 73, 26): '(2)', (73, 28, 73, 29): '(4)'}, {}), '(2, 4)', False, 'from ignition.math import Vector2d\n'), ((82, 16, 82, 30), 'ignition.math.Vector2d', 'Vector2d', ({(82, 25, 82, 26): '(2)', (82, 28, 82, 29): '(3)'}, {}), '(2, 3)', False, 'from ignition.math import Vector2d\n'), ((100, 16, 100, 30), 'ignition.math.Vector2d', 'Vector2d', ({(100, 25, 100, 26): '(2)', (100, 28, 100, 29): '(4)'}, {}), '(2, 4)', False, 'from ignition.math import Vector2d\n'), ((128, 37, 128, 55), 'ignition.math.Vector2d', 'Vector2d', ({(128, 46, 128, 49): '(0.3)', (128, 51, 128, 54): '(0.5)'}, {}), '(0.3, 0.5)', False, 'from ignition.math import Vector2d\n'), ((131, 37, 131, 55), 'ignition.math.Vector2d', 'Vector2d', ({(131, 46, 131, 49): '(0.4)', (131, 51, 131, 54): '(0.5)'}, {}), '(0.4, 0.5)', False, 'from ignition.math import Vector2d\n'), ((142, 37, 142, 55), 'ignition.math.Vector2d', 'Vector2d', ({(142, 46, 142, 49): '(0.1)', (142, 51, 142, 54): '(0.2)'}, {}), '(0.1, 0.2)', False, 'from ignition.math import Vector2d\n'), ((145, 37, 145, 56), 'ignition.math.Vector2d', 'Vector2d', ({(145, 46, 145, 50): '(0.05)', (145, 52, 145, 55): '(0.1)'}, {}), '(0.05, 0.1)', False, 'from ignition.math import Vector2d\n'), ((149, 25, 149, 64), 'ignition.math.Vector2d.ZERO.equal', 'Vector2d.ZERO.equal', ({(149, 45, 149, 57): 'Vector2d.ONE', (149, 59, 149, 63): '(1e-06)'}, {}), '(Vector2d.ONE, 1e-06)', False, 'from ignition.math import Vector2d\n'), ((150, 25, 150, 64), 'ignition.math.Vector2d.ZERO.equal', 'Vector2d.ZERO.equal', ({(150, 45, 150, 57): 'Vector2d.ONE', (150, 59, 150, 63): '(0.001)'}, {}), '(Vector2d.ONE, 0.001)', False, 'from ignition.math import Vector2d\n'), ((151, 25, 151, 64), 'ignition.math.Vector2d.ZERO.equal', 'Vector2d.ZERO.equal', ({(151, 45, 151, 57): 'Vector2d.ONE', (151, 59, 151, 63): '(0.1)'}, {}), '(Vector2d.ONE, 0.1)', False, 'from ignition.math import Vector2d\n'), ((152, 24, 152, 60), 'ignition.math.Vector2d.ZERO.equal', 'Vector2d.ZERO.equal', ({(152, 44, 152, 56): 'Vector2d.ONE', (152, 58, 152, 59): '(1)'}, {}), '(Vector2d.ONE, 1)', False, 'from ignition.math import Vector2d\n'), ((153, 24, 153, 62), 'ignition.math.Vector2d.ZERO.equal', 'Vector2d.ZERO.equal', ({(153, 44, 153, 56): 'Vector2d.ONE', (153, 58, 153, 61): '(1.1)'}, {}), '(Vector2d.ONE, 1.1)', False, 'from ignition.math import Vector2d\n'), ((171, 37, 171, 51), 'ignition.math.Vector2d', 'Vector2d', ({(171, 46, 171, 47): '(0)', (171, 49, 171, 50): '(0)'}, {}), '(0, 0)', False, 'from ignition.math import Vector2d\n'), ((172, 37, 172, 52), 'ignition.math.Vector2d', 'Vector2d', ({(172, 46, 172, 47): '(0)', (172, 49, 172, 51): '(-1)'}, {}), '(0, -1)', False, 'from ignition.math import Vector2d\n'), ((173, 37, 173, 53), 'ignition.math.Vector2d', 'Vector2d', ({(173, 46, 173, 48): '(10)', (173, 50, 173, 52): '(-2)'}, {}), '(10, -2)', False, 'from ignition.math import Vector2d\n'), ((190, 44, 190, 62), 'ignition.math.Vector2d', 'Vector2d', ({(190, 53, 190, 56): '(1.2)', (190, 58, 190, 61): '(2.4)'}, {}), '(1.2, 2.4)', False, 'from ignition.math import Vector2d\n'), ((191, 37, 191, 55), 'ignition.math.Vector2d', 'Vector2d', ({(191, 46, 191, 49): '(1.2)', (191, 51, 191, 54): '(2.4)'}, {}), '(1.2, 2.4)', False, 'from ignition.math import Vector2d\n'), ((209, 37, 209, 55), 'ignition.math.Vector2d', 'Vector2d', ({(209, 46, 209, 49): '(2.6)', (209, 51, 209, 54): '(2.7)'}, {}), '(2.6, 2.7)', False, 'from ignition.math import Vector2d\n'), ((213, 31, 213, 49), 'ignition.math.Vector2d', 'Vector2d', ({(213, 40, 213, 43): '(2.6)', (213, 45, 213, 48): '(2.7)'}, {}), '(2.6, 2.7)', False, 'from ignition.math import Vector2d\n'), ((222, 44, 222, 62), 'ignition.math.Vector2d', 'Vector2d', ({(222, 53, 222, 56): '(1.0)', (222, 58, 222, 61): '(2.0)'}, {}), '(1.0, 2.0)', False, 'from ignition.math import Vector2d\n'), ((223, 37, 223, 55), 'ignition.math.Vector2d', 'Vector2d', ({(223, 46, 223, 49): '(1.0)', (223, 51, 223, 54): '(2.0)'}, {}), '(1.0, 2.0)', False, 'from ignition.math import Vector2d\n'), ((251, 31, 251, 50), 'ignition.math.Vector2d', 'Vector2d', ({(251, 40, 251, 43): '(0.2)', (251, 45, 251, 49): '(-8.4)'}, {}), '(0.2, -8.4)', False, 'from ignition.math import Vector2d\n'), ((254, 31, 254, 51), 'ignition.math.Vector2d', 'Vector2d', ({(254, 40, 254, 43): '(0.8)', (254, 45, 254, 50): '(-33.6)'}, {}), '(0.8, -33.6)', False, 'from ignition.math import Vector2d\n'), ((277, 38, 277, 58), 'ignition.math.Vector2d', 'Vector2d', ({(277, 47, 277, 51): '(0.01)', (277, 53, 277, 57): '(0.25)'}, {}), '(0.01, 0.25)', False, 'from ignition.math import Vector2d\n'), ((281, 31, 281, 53), 'ignition.math.Vector2d.ZERO.length', 'Vector2d.ZERO.length', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((282, 31, 282, 61), 'ignition.math.Vector2d.ZERO.squared_length', 'Vector2d.ZERO.squared_length', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((285, 31, 285, 52), 'ignition.math.Vector2d.ONE.length', 'Vector2d.ONE.length', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((286, 31, 286, 43), 'math.sqrt', 'math.sqrt', ({(286, 41, 286, 42): '(2)'}, {}), '(2)', False, 'import math\n'), ((287, 31, 287, 60), 'ignition.math.Vector2d.ONE.squared_length', 'Vector2d.ONE.squared_length', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((47, 49, 47, 59), 'ignition.math.Vector2d', 'Vector2d', ({}, {}), '()', False, 'from ignition.math import Vector2d\n'), ((51, 32, 51, 60), 'ignition.math.Vector2d', 'Vector2d', ({(51, 41, 51, 49): '(0.447214)', (51, 51, 51, 59): '(0.894427)'}, {}), '(0.447214, 0.894427)', False, 'from ignition.math import Vector2d\n'), ((55, 32, 55, 46), 'ignition.math.Vector2d', 'Vector2d', ({(55, 41, 55, 42): '(4)', (55, 44, 55, 45): '(5)'}, {}), '(4, 5)', False, 'from ignition.math import Vector2d\n'), ((59, 38, 59, 52), 'ignition.math.Vector2d', 'Vector2d', ({(59, 47, 59, 48): '(1)', (59, 50, 59, 51): '(2)'}, {}), '(1, 2)', False, 'from ignition.math import Vector2d\n'), ((63, 32, 63, 46), 'ignition.math.Vector2d', 'Vector2d', ({(63, 41, 63, 42): '(6)', (63, 44, 63, 45): '(7)'}, {}), '(6, 7)', False, 'from ignition.math import Vector2d\n'), ((67, 32, 67, 46), 'ignition.math.Vector2d', 'Vector2d', ({(67, 41, 67, 42): '(7)', (67, 44, 67, 45): '(9)'}, {}), '(7, 9)', False, 'from ignition.math import Vector2d\n'), ((70, 32, 70, 48), 'ignition.math.Vector2d', 'Vector2d', ({(70, 41, 70, 43): '(12)', (70, 45, 70, 47): '(15)'}, {}), '(12, 15)', False, 'from ignition.math import Vector2d\n'), ((74, 32, 74, 48), 'ignition.math.Vector2d', 'Vector2d', ({(74, 41, 74, 43): '(10)', (74, 45, 74, 47): '(11)'}, {}), '(10, 11)', False, 'from ignition.math import Vector2d\n'), ((78, 32, 78, 47), 'ignition.math.Vector2d', 'Vector2d', ({(78, 41, 78, 42): '(1)', (78, 44, 78, 46): '(-2)'}, {}), '(1, -2)', False, 'from ignition.math import Vector2d\n'), ((83, 32, 83, 46), 'ignition.math.Vector2d', 'Vector2d', ({(83, 41, 83, 42): '(5)', (83, 44, 83, 45): '(2)'}, {}), '(5, 2)', False, 'from ignition.math import Vector2d\n'), ((87, 32, 87, 46), 'ignition.math.Vector2d', 'Vector2d', ({(87, 41, 87, 42): '(5)', (87, 44, 87, 45): '(2)'}, {}), '(5, 2)', False, 'from ignition.math import Vector2d\n'), ((92, 32, 92, 46), 'ignition.math.Vector2d', 'Vector2d', ({(92, 41, 92, 42): '(5)', (92, 44, 92, 45): '(3)'}, {}), '(5, 3)', False, 'from ignition.math import Vector2d\n'), ((96, 32, 96, 46), 'ignition.math.Vector2d', 'Vector2d', ({(96, 41, 96, 42): '(5)', (96, 44, 96, 45): '(3)'}, {}), '(5, 3)', False, 'from ignition.math import Vector2d\n'), ((101, 32, 101, 48), 'ignition.math.Vector2d', 'Vector2d', ({(101, 41, 101, 43): '(20)', (101, 45, 101, 47): '(24)'}, {}), '(20, 24)', False, 'from ignition.math import Vector2d\n'), ((105, 32, 105, 48), 'ignition.math.Vector2d', 'Vector2d', ({(105, 41, 105, 43): '(20)', (105, 45, 105, 47): '(24)'}, {}), '(20, 24)', False, 'from ignition.math import Vector2d\n'), ((110, 32, 110, 48), 'ignition.math.Vector2d', 'Vector2d', ({(110, 41, 110, 43): '(20)', (110, 45, 110, 47): '(12)'}, {}), '(20, 12)', False, 'from ignition.math import Vector2d\n'), ((114, 32, 114, 48), 'ignition.math.Vector2d', 'Vector2d', ({(114, 41, 114, 43): '(20)', (114, 45, 114, 47): '(12)'}, {}), '(20, 12)', False, 'from ignition.math import Vector2d\n'), ((157, 37, 157, 51), 'ignition.math.Vector2d', 'Vector2d', ({(157, 46, 157, 47): '(3)', (157, 49, 157, 50): '(4)'}, {}), '(3, 4)', False, 'from ignition.math import Vector2d\n'), ((158, 37, 158, 51), 'ignition.math.Vector2d', 'Vector2d', ({(158, 46, 158, 47): '(0)', (158, 49, 158, 50): '(0)'}, {}), '(0, 0)', False, 'from ignition.math import Vector2d\n'), ((159, 37, 159, 51), 'ignition.math.Vector2d', 'Vector2d', ({(159, 46, 159, 47): '(1)', (159, 49, 159, 50): '(0)'}, {}), '(1, 0)', False, 'from ignition.math import Vector2d\n'), ((160, 37, 160, 51), 'ignition.math.Vector2d', 'Vector2d', ({(160, 46, 160, 47): '(0)', (160, 49, 160, 50): '(1)'}, {}), '(0, 1)', False, 'from ignition.math import Vector2d\n'), ((178, 41, 178, 55), 'ignition.math.Vector2d', 'Vector2d', ({(178, 50, 178, 51): '(3)', (178, 53, 178, 54): '(4)'}, {}), '(3, 4)', False, 'from ignition.math import Vector2d\n'), ((179, 41, 179, 55), 'ignition.math.Vector2d', 'Vector2d', ({(179, 50, 179, 51): '(0)', (179, 53, 179, 54): '(0)'}, {}), '(0, 0)', False, 'from ignition.math import Vector2d\n'), ((180, 41, 180, 55), 'ignition.math.Vector2d', 'Vector2d', ({(180, 50, 180, 51): '(1)', (180, 53, 180, 54): '(0)'}, {}), '(1, 0)', False, 'from ignition.math import Vector2d\n'), ((181, 41, 181, 55), 'ignition.math.Vector2d', 'Vector2d', ({(181, 50, 181, 51): '(0)', (181, 53, 181, 54): '(1)'}, {}), '(0, 1)', False, 'from ignition.math import Vector2d\n'), ((241, 38, 241, 56), 'ignition.math.Vector2d', 'Vector2d', ({(241, 47, 241, 50): '(2.4)', (241, 52, 241, 55): '(2.3)'}, {}), '(2.4, 2.3)', False, 'from ignition.math import Vector2d\n'), ((245, 32, 245, 50), 'ignition.math.Vector2d', 'Vector2d', ({(245, 41, 245, 44): '(2.4)', (245, 46, 245, 49): '(2.3)'}, {}), '(2.4, 2.3)', False, 'from ignition.math import Vector2d\n')]