def test_bbox_ra_90(self): assert similar([0, 20, 20, 20], RingSegment(10, 0, 10, 90).bbox_ra()) assert similar([-30, 30, 30, 30], RingSegment(20, 90, 10, 90).bbox_ra()) assert similar([-20, 0, 20, 20], RingSegment(10, 180, 10, 90).bbox_ra()) assert similar([0, 0, 20, 20], RingSegment(10, -90, 10, 90).bbox_ra())
def test_points_ra_n90(self): assert similar([[-10, 0], [-30, 0], [0, -30], [0, -10]], RingSegment(10, 180, 20, 90).points_ra()) assert similar([[0, 10], [0, 20], [0, -20], [0, -10]], RingSegment(10, 90, 10, 180).points_ra()) assert similar([[10, 0], [30, 0], [30, 0], [10, 0]], RingSegment(10, 0, 20, 360).points_ra())
def test_points_ra_fract(self): assert similar([[20, 0], [30, 0], [25.98, 15], [17.32, 10]], RingSegment(20, 0, 10, 30).points_ra()) assert similar([[20, 0], [30, 0], [-5.21, 29.544], [-3.473, 19.696]], RingSegment(20, 0, 10, 100).points_ra()) assert similar([[20, 0], [30, 0], [-15, 25.98], [-10, 17.32]], RingSegment(20, 0, 10, 120).points_ra()) assert similar([[17.32, -10], [25.98, -15], [-21.213, -21.213], [-14.142, -14.142]], RingSegment(20, -30, 10, 255).points_ra())
def test_bbox_ra_frac(self): assert similar([-20, 20, 40, 20], RingSegment(10, 0, 10, 180).bbox_ra()) assert similar([-10, 20, 30, 20], RingSegment(10, 0, 10, 120).bbox_ra())
def test_bbox_ra_arc(self): assert similar([-10, 20, 20, 11.34], RingSegment(10, 60, 10, 60).bbox_ra()) assert similar([-10, -8.66, 20, 11.34], RingSegment(10, 240, 10, 60).bbox_ra())
def test_bbox_ra_non(self): assert similar([0, 0, 0, 0], RingSegment(0, 0, 0, 0).bbox_ra()) assert similar([10, 0, 0, 0], RingSegment(10, 0, 0, 0).bbox_ra()) assert similar([10, 0, 10, 0], RingSegment(10, 0, 10, 0).bbox_ra()) assert similar([0, 10, 10, 10], RingSegment(10, 0, 0, 90).bbox_ra())
def test_limitAt_ang(self): assert similar(20, RingSegment(10, 350, 10, 20).limitAt(0, None)) assert similar(20, RingSegment(10, 80, 10, 20).limitAt(1, None)) assert similar(-20, RingSegment(10, 170, 10, 20).limitAt(2, None)) assert similar(-20, RingSegment(10, 260, 10, 20).limitAt(3, None))
def test_limitAt_360(self): assert similar(20, RingSegment(10, 0, 10, 360).limitAt(0, None)) assert similar(20, RingSegment(10, 0, 10, 360).limitAt(1, None)) assert similar(-20, RingSegment(10, 0, 10, 360).limitAt(2, None)) assert similar(-20, RingSegment(10, 0, 10, 360).limitAt(3, None))
def test_ra2xy(self): assert similar([0, 10], ra2xy(10, 90)) assert similar([8.66, 5], ra2xy(10, 30))
def test_limitAt_non(self): assert similar(0, RingSegment(0, 0, 0, 0).limitAt(0, None)) assert similar(10, RingSegment(10, 0, 0, 0).limitAt(0, None)) assert similar(20, RingSegment(10, 0, 10, 0).limitAt(0, None))
def test_xy2ra(self): assert similar([10, 90], xy2ra(0, 10)) assert similar([10, 30], xy2ra(8.66, 5))