# Path: tests_basic/utils.py
# def point_equality_validation(point1, point2):
#     if point1.x != point2.x:
#         raise ValueError("{} does not equal {}".format(point1.x, point2.x))
#     if point1.y != point2.y:
#         raise ValueError("{} does not equal {}".format(point1.y, point2.y))


import unittest
from pylinac.core.geometry import *
from tests_basic.utils import point_equality_validation

        point = Point(1, 1)
        line = Line((0, 0), (1, 1))
        exp_dist = 0
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)

        point = Point(1, 1, 1)
        line = Line((0,0,0), (0, 0, 1))
        exp_dist = math.sqrt(2)
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)

        point = Point(3, 0, 0)
        line = Line((0, 0, 0), (3, 3, 0))
        exp_dist = math.sqrt(18) / 2
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)


class TestRectangle(unittest.TestCase):
    width = 6.9
    height = 4.1
    center = Point(10, 10)
    bl_corner = Point(10-6.9/2, 10-4.1/2)
    br_corner = Point(10 + 6.9 / 2, 10 - 4.1 / 2)
    tr_corner = Point(10 + 6.9 / 2, 10 + 4.1 / 2)
    tl_corner = Point(10 - 6.9 / 2, 10 + 4.1 / 2)

    def test_init(self):
        rect = Rectangle(width=self.width, height=self.height, center=self.center)
        self.assertEqual(rect.width, self.width)
        self.assertEqual(rect.height, self.height)

# Path: tests_basic/utils.py
# def point_equality_validation(point1, point2):
#     if point1.x != point2.x:
#         raise ValueError("{} does not equal {}".format(point1.x, point2.x))
#     if point1.y != point2.y:
#         raise ValueError("{} does not equal {}".format(point1.y, point2.y))


# Path: tests_basic/core/test_geometry.py
import unittest
from pylinac.core.geometry import *
from tests_basic.utils import point_equality_validation


        point = Point(1, 1)
        line = Line((0, 0), (1, 1))
        exp_dist = 0
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)

        point = Point(1, 1, 1)
        line = Line((0,0,0), (0, 0, 1))
        exp_dist = math.sqrt(2)
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)

        point = Point(3, 0, 0)
        line = Line((0, 0, 0), (3, 3, 0))
        exp_dist = math.sqrt(18) / 2
        self.assertAlmostEqual(line.distance_to(point), exp_dist, delta=0.01)


class TestRectangle(unittest.TestCase):
    width = 6.9
    height = 4.1
    center = Point(10, 10)
    bl_corner = Point(10-6.9/2, 10-4.1/2)
    br_corner = Point(10 + 6.9 / 2, 10 - 4.1 / 2)
    tr_corner = Point(10 + 6.9 / 2, 10 + 4.1 / 2)
    tl_corner = Point(10 - 6.9 / 2, 10 + 4.1 / 2)

    def test_init(self):
        rect = Rectangle(width=self.width, height=self.height, center=self.center)
        self.assertEqual(rect.width, self.width)
        self.assertEqual(rect.height, self.height)

        point_equality_validation(rect.center, self.center)