# Procedures for creating examples of contacts between paths. # Last edited on 2021-03-19 13:56:08 by jstolfi import contact_example_IMP import move import move_parms import path import pyx # CONTACTS def raster_raster_contact(oph0, oph1): # Assumes that {oph0} and {oph1} are paths made of horizontal raster # lines connected by jumps or links, such that the topmost trace of # {oph0} is adjacent to the bottommost trace of {oph1}, and they have # overlapping {X} ranges. Creates and returns a new {Contact} object # between those two traces. # # The contact will be undirected. return contact_example_IMP.raster_raster_contact(oph0, oph1) # SAMPLE CONTACTS FOR THE UNIT TEST PROGRAM # These test data assume that the width of the filling trace is 1.0 mm, since # then the nominal sausages of the sides actually touch each other. def misc_A(mp_trace): # Returns a single contact {ct} between two new traces. # # The moves {side(ct,i)} are # # i pini pfin # - ----- ----- # 0 (1,1) (4,1) # 1 (2,2) (5,2) # # The endpoints of the contact are {(2,1.5)} and {(4,1.5)}. return contact_example_IMP.misc_A(mp_trace) def misc_B(mp_trace, mp_jump): # Returns a list {CTS} of eight contacts between the ten traces of the # five oriented paths created by {path_example.misc_E} with # aruments {mp_trace, mp_jump}. Also returns the list {OPHS} of those # oriented paths and the list {TRS} of those ten traces. # # The sides {side(CTS[k],i)} of the contacts, and their midpoints, are # # k side0 side1 pmid obs # - ------ ------ ---------- ----- # 0 TRS[0] TRS[1] (2.5, 3.5) # 1 TRS[1] TRS[2] (4.0, 3.5) single point # 2 TRS[0] TRS[2] (3.5, 3.0) single point # 3 TRS[2] TRS[3] (%%%, 2.0) # 4 TRS[1] TRS[4] (5.0, 4.5) single point # 5 TRS[7] TRS[9] (3.5, 7.5) # 6 TRS[8] TRS[9] (5.5, 7.5) # 7 TRS[7] TRS[5] (3.5, 6.5) # # where "%%%" means a bit more than 5.0. # return contact_example_IMP.misc_B(mp_trace, mp_jump) def misc_C(mp_trace): # Creates two serpentine paths side by side, one with horizontal rasters, one with # vertical rasters, and returns a list {CTS} of the contacts between them. # Also returns a list {PHS} of the two paths. return contact_example_IMP.misc_C(mp_trace)