def test_comparison_function_ends_touch_right(self): e1 = self.dc.createEdge(np.array([1, 1]), np.array([0, 0])) e2 = self.dc.createEdge(np.array([1, 0.5]), np.array([0, 0])) self.assertEqual( li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0.5 }), Directions.RIGHT) self.assertEqual(li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0 }), Directions.RIGHT)
def test_comparison_function_crossover_left(self): e1 = self.dc.createEdge(np.array([0, 1]), np.array([1, 0])) e2 = self.dc.createEdge(np.array([1, 1]), np.array([0, 0])) self.assertEqual(li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0 }), Directions.LEFT)
def test_comparison_function_crossover_defaults_to_left(self): e1 = self.dc.createEdge(np.array([0, 1]), np.array([1, 0])) e2 = self.dc.createEdge(np.array([1, 1]), np.array([0, 0])) self.assertEqual( li.lineCmp(MockNode(e1), e2, { 'nudge': 1e-2, "y": 0.5 }), Directions.RIGHT)
def test_comparison_function_simple_defaults_to_right(self): e1 = self.dc.createEdge(np.array([1, 1]), np.array([1, 0])) e2 = self.dc.createEdge(np.array([1, 1]), np.array([1, 0])) self.assertEqual( li.lineCmp(MockNode(e2), e1, { "nudge": 1e-2, "y": 0.5 }), Directions.RIGHT)
def test_comparison_function_flat_as_itself(self): e1 = self.dc.createEdge(np.array([0, 0]), np.array([1, 0])) self.assertEqual( li.lineCmp(MockNode(e1), e1, { "nudge": 1e-2, "y": 0, "x": 0.5 }), Directions.RIGHT)
def test_comparison_function_flat_simple_defaults_to_left(self): e1 = self.dc.createEdge(np.array([0.5, 1]), np.array([0.5, 0])) e2 = self.dc.createEdge(np.array([0, 0.5]), np.array([1, 0.5])) self.assertEqual( li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0.5, "x": 0.5 }), Directions.RIGHT)
def test_comparison_function_double_flat_left(self): e1 = self.dc.createEdge(np.array([0.5, 0]), np.array([1, 0])) e2 = self.dc.createEdge(np.array([0.2, 0]), np.array([0.7, 0])) self.assertEqual( li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0, "x": 0.3 }), Directions.LEFT)
def test_comparison_function_double_flat_dual(self): e1 = self.dc.createEdge(np.array([0.5, 0]), np.array([1, 0])) e2 = self.dc.createEdge(np.array([0.7, 0]), np.array([1.2, 0])) #reminder: can two hlines have one to the right? self.assertEqual( li.lineCmp(MockNode(e1), e2, { "nudge": 1e-2, "y": 0, "x": 1.1 }), Directions.RIGHT)