Example #1
0
 def test_parallel(self):
     dist = line_distance_segment(Point2(0, 0), Point2(0, 3), Point2(3, -1),
                                  Point2(3, 7))
     self.assertAlmostEqual(dist, 3, 3)
Example #2
0
 def test_colinear(self):
     dist = line_distance_segment(Point2(2, 2), Point2(3, 3), Point2(4, 4),
                                  Point2(5, 5))
     self.assertAlmostEqual(dist, ROOT_2, 3)
Example #3
0
 def test_intersect(self):
     dist = line_distance_segment(Point2(4.5, 0), Point2(4.5, 10),
                                  Point2(4, 4), Point2(5, 5))
     self.assertAlmostEqual(dist, 0, 3)
Example #4
0
def dist_trace_trace(trace_1, trace_2):
    if trace_1.layer != trace_2.layer:
        return float("inf")
    d = line_distance_segment(trace_1.p0, trace_1.p1, trace_2.p0, trace_2.p1)
    return d - trace_1.thickness/2 - trace_2.thickness/2
Example #5
0
File: geom.py Project: balr0g/pcbre
def dist_trace_trace(trace_1, trace_2):
    if trace_1.layer != trace_2.layer:
        return float("inf")
    d = line_distance_segment(trace_1.p0, trace_1.p1, trace_2.p0, trace_2.p1)
    return d - trace_1.thickness / 2 - trace_2.thickness / 2
 def test_non_colinear(self):
     dist = line_distance_segment(Point2(1,2), Point2(3,3), Point2(4,4), Point2(5,5))
     self.assertAlmostEqual(dist, ROOT_2, 3)
 def test_parallel(self):
     dist = line_distance_segment(Point2(0,0), Point2(0,3), Point2(3,-1), Point2(3,7))
     self.assertAlmostEqual(dist, 3, 3)
 def test_intersect(self):
     dist = line_distance_segment(Point2(4.5,0), Point2(4.5,10), Point2(4,4), Point2(5,5))
     self.assertAlmostEqual(dist, 0, 3)