# No. 142 (Brown 1868): "Movement used for varying the length of the traversing guide-bar which, in silk machinery, guides the silk on to spools or bobbins. The spur-gear, turning freely on its center, is carried round by the larger circular disk, which turns on a fixed central stud, which has a pinion fast on its end. Upon the spur-gear is bolted a small crank, to which is jointed a connecting-rod attached to traversing guide-bar. ..."
#
# Model (cm, no gravity): a 12-tooth pinion (module 0.8) is fast on the fixed stud; the large disc turning on the stud is the one driven joint (15 turns a minute, clockwise in the view). The 24-tooth spur gear, turning freely on its pin in the disc, meshes with the
# pinion by real teeth and so turns 0.5 of a turn relative to the disc for each turn of the disc. A crank 6.0 cm long is bolted on the spur gear, a connecting rod 30.0 cm long joins it to the traversing guide-bar, which slides in fixed guides. Every disc turn the crank has
# swung round towards or away from the disc's centre, so the bar's throw first grows to 20.4 and then shrinks to 8.4 cm on each side (a full cycle in 2.0 turns). Generator: opencode-runs/batch10/gen142.py.
number: 142
slug: traverse-guide-bar
name: A traversing guide-bar of varying stroke
brown: "Movement used for varying the length of the traversing guide-bar which, in silk machinery, guides the silk on to spools or bobbins. The spur-gear, turning freely on its center, is carried round by the larger circular disk, which turns on a fixed central stud, which has a pinion fast on its end. Upon the spur-gear is bolted a small crank, to which is jointed a connecting-rod attached to traversing guide-bar."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 9.6
  floor: false
  gravity: 0
bodies:
  - id: stud
    shape: part
    pos: [0, 0, 0]
    fixed: true
    density: 7800
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 0], radius: 3.75, inner: 0.6, y: [-0.8, 0.8]}
      - {kind: rod, from: [0, -1.2, 0], to: [0, 3.5, 0], radius: 0.6, color: "#8f8a80"}
      - {kind: poly, points: [[3.3852, -0.4863], [4.4647, -0.6414], [4.5748, -0.6409], [4.6867, -0.6265], [4.7997, -0.6024], [4.9133, -0.5701], [5.0274, -0.5303], [5.1415, -0.4834], [5.2556, -0.4299], [5.3694, -0.3698], [5.4827, -0.3034], [5.5952, -0.2308], [5.5952, 0.2308], [5.4827, 0.3034], [5.3694, 0.3698], [5.2556, 0.4299], [5.1415, 0.4834], [5.0274, 0.5303], [4.9133, 0.5701], [4.7997, 0.6024], [4.6867, 0.6265], [4.5748, 0.6409], [4.4647, 0.6414], [3.3852, 0.4863]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[3.1749, 1.2715], [4.1872, 1.6769], [4.2823, 1.7324], [4.3721, 1.8008], [4.4579, 1.8781], [4.5401, 1.9629], [4.619, 2.0544], [4.6944, 2.1521], [4.7664, 2.2555], [4.8349, 2.3645], [4.8998, 2.4786], [4.961, 2.5977], [4.7302, 2.9975], [4.5964, 3.0041], [4.4651, 3.0049], [4.3366, 3.0001], [4.211, 2.9894], [4.0887, 2.973], [3.97, 2.9504], [3.8555, 2.9216], [3.7456, 2.8859], [3.6415, 2.8424], [3.5458, 2.7878], [2.6886, 2.1138]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[2.1138, 2.6886], [2.7878, 3.5458], [2.8424, 3.6415], [2.8859, 3.7456], [2.9216, 3.8555], [2.9504, 3.97], [2.973, 4.0887], [2.9894, 4.211], [3.0001, 4.3366], [3.0049, 4.4651], [3.0041, 4.5964], [2.9975, 4.7302], [2.5977, 4.961], [2.4786, 4.8998], [2.3645, 4.8349], [2.2555, 4.7664], [2.1521, 4.6944], [2.0544, 4.619], [1.9629, 4.5401], [1.8781, 4.4579], [1.8008, 4.3721], [1.7324, 4.2823], [1.6769, 4.1872], [1.2715, 3.1749]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[0.4863, 3.3852], [0.6414, 4.4647], [0.6409, 4.5748], [0.6265, 4.6867], [0.6024, 4.7997], [0.5701, 4.9133], [0.5303, 5.0274], [0.4834, 5.1415], [0.4299, 5.2556], [0.3698, 5.3694], [0.3034, 5.4827], [0.2308, 5.5952], [-0.2308, 5.5952], [-0.3034, 5.4827], [-0.3698, 5.3694], [-0.4299, 5.2556], [-0.4834, 5.1415], [-0.5303, 5.0274], [-0.5701, 4.9133], [-0.6024, 4.7997], [-0.6265, 4.6867], [-0.6409, 4.5748], [-0.6414, 4.4647], [-0.4863, 3.3852]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-1.2715, 3.1749], [-1.6769, 4.1872], [-1.7324, 4.2823], [-1.8008, 4.3721], [-1.8781, 4.4579], [-1.9629, 4.5401], [-2.0544, 4.619], [-2.1521, 4.6944], [-2.2555, 4.7664], [-2.3645, 4.8349], [-2.4786, 4.8998], [-2.5977, 4.961], [-2.9975, 4.7302], [-3.0041, 4.5964], [-3.0049, 4.4651], [-3.0001, 4.3366], [-2.9894, 4.211], [-2.973, 4.0887], [-2.9504, 3.97], [-2.9216, 3.8555], [-2.8859, 3.7456], [-2.8424, 3.6415], [-2.7878, 3.5458], [-2.1138, 2.6886]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-2.6886, 2.1138], [-3.5458, 2.7878], [-3.6415, 2.8424], [-3.7456, 2.8859], [-3.8555, 2.9216], [-3.97, 2.9504], [-4.0887, 2.973], [-4.211, 2.9894], [-4.3366, 3.0001], [-4.4651, 3.0049], [-4.5964, 3.0041], [-4.7302, 2.9975], [-4.961, 2.5977], [-4.8998, 2.4786], [-4.8349, 2.3645], [-4.7664, 2.2555], [-4.6944, 2.1521], [-4.619, 2.0544], [-4.5401, 1.9629], [-4.4579, 1.8781], [-4.3721, 1.8008], [-4.2823, 1.7324], [-4.1872, 1.6769], [-3.1749, 1.2715]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-3.3852, 0.4863], [-4.4647, 0.6414], [-4.5748, 0.6409], [-4.6867, 0.6265], [-4.7997, 0.6024], [-4.9133, 0.5701], [-5.0274, 0.5303], [-5.1415, 0.4834], [-5.2556, 0.4299], [-5.3694, 0.3698], [-5.4827, 0.3034], [-5.5952, 0.2308], [-5.5952, -0.2308], [-5.4827, -0.3034], [-5.3694, -0.3698], [-5.2556, -0.4299], [-5.1415, -0.4834], [-5.0274, -0.5303], [-4.9133, -0.5701], [-4.7997, -0.6024], [-4.6867, -0.6265], [-4.5748, -0.6409], [-4.4647, -0.6414], [-3.3852, -0.4863]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-3.1749, -1.2715], [-4.1872, -1.6769], [-4.2823, -1.7324], [-4.3721, -1.8008], [-4.4579, -1.8781], [-4.5401, -1.9629], [-4.619, -2.0544], [-4.6944, -2.1521], [-4.7664, -2.2555], [-4.8349, -2.3645], [-4.8998, -2.4786], [-4.961, -2.5977], [-4.7302, -2.9975], [-4.5964, -3.0041], [-4.4651, -3.0049], [-4.3366, -3.0001], [-4.211, -2.9894], [-4.0887, -2.973], [-3.97, -2.9504], [-3.8555, -2.9216], [-3.7456, -2.8859], [-3.6415, -2.8424], [-3.5458, -2.7878], [-2.6886, -2.1138]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-2.1138, -2.6886], [-2.7878, -3.5458], [-2.8424, -3.6415], [-2.8859, -3.7456], [-2.9216, -3.8555], [-2.9504, -3.97], [-2.973, -4.0887], [-2.9894, -4.211], [-3.0001, -4.3366], [-3.0049, -4.4651], [-3.0041, -4.5964], [-2.9975, -4.7302], [-2.5977, -4.961], [-2.4786, -4.8998], [-2.3645, -4.8349], [-2.2555, -4.7664], [-2.1521, -4.6944], [-2.0544, -4.619], [-1.9629, -4.5401], [-1.8781, -4.4579], [-1.8008, -4.3721], [-1.7324, -4.2823], [-1.6769, -4.1872], [-1.2715, -3.1749]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[-0.4863, -3.3852], [-0.6414, -4.4647], [-0.6409, -4.5748], [-0.6265, -4.6867], [-0.6024, -4.7997], [-0.5701, -4.9133], [-0.5303, -5.0274], [-0.4834, -5.1415], [-0.4299, -5.2556], [-0.3698, -5.3694], [-0.3034, -5.4827], [-0.2308, -5.5952], [0.2308, -5.5952], [0.3034, -5.4827], [0.3698, -5.3694], [0.4299, -5.2556], [0.4834, -5.1415], [0.5303, -5.0274], [0.5701, -4.9133], [0.6024, -4.7997], [0.6265, -4.6867], [0.6409, -4.5748], [0.6414, -4.4647], [0.4863, -3.3852]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[1.2715, -3.1749], [1.6769, -4.1872], [1.7324, -4.2823], [1.8008, -4.3721], [1.8781, -4.4579], [1.9629, -4.5401], [2.0544, -4.619], [2.1521, -4.6944], [2.2555, -4.7664], [2.3645, -4.8349], [2.4786, -4.8998], [2.5977, -4.961], [2.9975, -4.7302], [3.0041, -4.5964], [3.0049, -4.4651], [3.0001, -4.3366], [2.9894, -4.211], [2.973, -4.0887], [2.9504, -3.97], [2.9216, -3.8555], [2.8859, -3.7456], [2.8424, -3.6415], [2.7878, -3.5458], [2.1138, -2.6886]], y: [-0.8, 0.8], collide: 1}
      - {kind: poly, points: [[2.6886, -2.1138], [3.5458, -2.7878], [3.6415, -2.8424], [3.7456, -2.8859], [3.8555, -2.9216], [3.97, -2.9504], [4.0887, -2.973], [4.211, -2.9894], [4.3366, -3.0001], [4.4651, -3.0049], [4.5964, -3.0041], [4.7302, -2.9975], [4.961, -2.5977], [4.8998, -2.4786], [4.8349, -2.3645], [4.7664, -2.2555], [4.6944, -2.1521], [4.619, -2.0544], [4.5401, -1.9629], [4.4579, -1.8781], [4.3721, -1.8008], [4.2823, -1.7324], [4.1872, -1.6769], [3.1749, -1.2715]], y: [-0.8, 0.8], collide: 1}
  - id: disc
    shape: part
    pos: [0, 0, 0]
    mass: 0.5
    color: "#d8d0bd"
    pieces:
      - {kind: disc, center: [0, 0], radius: 25.5, inner: 1.0, y: [1.0, 2.0]}
  - id: gear
    shape: part
    pos: [14.400000000000002, 0, 0]
    mount: disc
    mass: 0.3
    density: 7800
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [14.400000000000002, 0], radius: 8.55, inner: 1.0, y: [-0.8, 0.8]}
      - {kind: rod, from: [14.400000000000002, -1.9, 0], to: [14.400000000000002, 1.4, 0], radius: 0.7, color: "#8f8a80"}
      - {kind: poly, points: [[14.4, 0.8], [20.4, 0.8], [20.4, -0.8], [14.4, -0.8]], y: [-1.9, -1.0], collide: 0, color: "#a89a7e"}
      - {kind: disc, center: [20.4, -0.0], radius: 1.3, inner: 0.35, y: [-1.9, -1.0], color: "#a89a7e"}
      - {kind: poly, points: [[6.6705, -0.4031], [5.3912, -0.4699], [5.2543, -0.4932], [5.1183, -0.5304], [4.9829, -0.5769], [4.8482, -0.6312], [4.7142, -0.6925], [4.581, -0.7603], [4.4486, -0.8341], [4.3171, -0.9137], [4.1866, -0.9989], [4.0572, -1.0894], [4.1277, -1.6246], [4.2761, -1.6786], [4.4242, -1.727], [4.5718, -1.7699], [4.7188, -1.807], [4.865, -1.8379], [5.0103, -1.8625], [5.1545, -1.8801], [5.2973, -1.89], [5.4383, -1.8907], [5.5766, -1.8778], [6.8295, -1.6111]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[7.0382, -2.3899], [5.8198, -2.7855], [5.6936, -2.8435], [5.5718, -2.9146], [5.4531, -2.9945], [5.337, -3.0819], [5.2235, -3.1758], [5.1123, -3.2758], [5.0036, -3.3813], [4.8972, -3.4923], [4.7932, -3.6083], [4.6916, -3.7292], [4.8982, -4.228], [5.0555, -4.2416], [5.2111, -4.2501], [5.3647, -4.2533], [5.5163, -4.2511], [5.6656, -4.2432], [5.8123, -4.2293], [5.9561, -4.209], [6.0966, -4.1815], [6.233, -4.1457], [6.3632, -4.0975], [7.5045, -3.5156]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[7.9076, -4.2139], [6.8331, -4.9113], [6.7262, -5.0], [6.627, -5.1002], [6.533, -5.2081], [6.4435, -5.3225], [6.3581, -5.4426], [6.2766, -5.568], [6.1989, -5.6981], [6.1248, -5.8328], [6.0544, -5.9718], [5.9876, -6.1148], [6.3162, -6.5431], [6.4717, -6.5156], [6.6242, -6.4836], [6.7735, -6.4469], [6.9193, -6.4055], [7.0614, -6.3592], [7.1995, -6.3078], [7.3332, -6.251], [7.4618, -6.1881], [7.5843, -6.1182], [7.6976, -6.0379], [8.6494, -5.1805]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[9.2195, -5.7506], [8.3621, -6.7024], [8.2818, -6.8157], [8.2119, -6.9382], [8.149, -7.0668], [8.0922, -7.2005], [8.0408, -7.3386], [7.9945, -7.4807], [7.9531, -7.6265], [7.9164, -7.7758], [7.8844, -7.9283], [7.8569, -8.0838], [8.2852, -8.4124], [8.4282, -8.3456], [8.5672, -8.2752], [8.7019, -8.2011], [8.832, -8.1234], [8.9574, -8.0419], [9.0775, -7.9565], [9.1919, -7.867], [9.2998, -7.773], [9.4, -7.6738], [9.4887, -7.5669], [10.1861, -6.4924]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[10.8844, -6.8955], [10.3025, -8.0368], [10.2543, -8.167], [10.2185, -8.3034], [10.191, -8.4439], [10.1707, -8.5877], [10.1568, -8.7344], [10.1489, -8.8837], [10.1467, -9.0353], [10.1499, -9.1889], [10.1584, -9.3445], [10.172, -9.5018], [10.6708, -9.7084], [10.7917, -9.6068], [10.9077, -9.5028], [11.0187, -9.3964], [11.1242, -9.2877], [11.2242, -9.1765], [11.3181, -9.063], [11.4055, -8.9469], [11.4854, -8.8282], [11.5565, -8.7064], [11.6145, -8.5802], [12.0101, -7.3618]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[12.7889, -7.5705], [12.5222, -8.8234], [12.5093, -8.9617], [12.51, -9.1027], [12.5199, -9.2455], [12.5375, -9.3897], [12.5621, -9.535], [12.593, -9.6812], [12.6301, -9.8282], [12.673, -9.9758], [12.7214, -10.1239], [12.7754, -10.2723], [13.3106, -10.3428], [13.4011, -10.2134], [13.4863, -10.0829], [13.5659, -9.9514], [13.6397, -9.819], [13.7075, -9.6858], [13.7688, -9.5518], [13.8231, -9.4171], [13.8696, -9.2817], [13.9068, -9.1457], [13.9301, -9.0088], [13.9969, -7.7295]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[14.8031, -7.7295], [14.8699, -9.0088], [14.8932, -9.1457], [14.9304, -9.2817], [14.9769, -9.4171], [15.0312, -9.5518], [15.0925, -9.6858], [15.1603, -9.819], [15.2341, -9.9514], [15.3137, -10.0829], [15.3989, -10.2134], [15.4894, -10.3428], [16.0246, -10.2723], [16.0786, -10.1239], [16.127, -9.9758], [16.1699, -9.8282], [16.207, -9.6812], [16.2379, -9.535], [16.2625, -9.3897], [16.2801, -9.2455], [16.29, -9.1027], [16.2907, -8.9617], [16.2778, -8.8234], [16.0111, -7.5705]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[16.7899, -7.3618], [17.1855, -8.5802], [17.2435, -8.7064], [17.3146, -8.8282], [17.3945, -8.9469], [17.4819, -9.063], [17.5758, -9.1765], [17.6758, -9.2877], [17.7813, -9.3964], [17.8923, -9.5028], [18.0083, -9.6068], [18.1292, -9.7084], [18.628, -9.5018], [18.6416, -9.3445], [18.6501, -9.1889], [18.6533, -9.0353], [18.6511, -8.8837], [18.6432, -8.7344], [18.6293, -8.5877], [18.609, -8.4439], [18.5815, -8.3034], [18.5457, -8.167], [18.4975, -8.0368], [17.9156, -6.8955]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[18.6139, -6.4924], [19.3113, -7.5669], [19.4, -7.6738], [19.5002, -7.773], [19.6081, -7.867], [19.7225, -7.9565], [19.8426, -8.0419], [19.968, -8.1234], [20.0981, -8.2011], [20.2328, -8.2752], [20.3718, -8.3456], [20.5148, -8.4124], [20.9431, -8.0838], [20.9156, -7.9283], [20.8836, -7.7758], [20.8469, -7.6265], [20.8055, -7.4807], [20.7592, -7.3386], [20.7078, -7.2005], [20.651, -7.0668], [20.5881, -6.9382], [20.5182, -6.8157], [20.4379, -6.7024], [19.5805, -5.7506]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[20.1506, -5.1805], [21.1024, -6.0379], [21.2157, -6.1182], [21.3382, -6.1881], [21.4668, -6.251], [21.6005, -6.3078], [21.7386, -6.3592], [21.8807, -6.4055], [22.0265, -6.4469], [22.1758, -6.4836], [22.3283, -6.5156], [22.4838, -6.5431], [22.8124, -6.1148], [22.7456, -5.9718], [22.6752, -5.8328], [22.6011, -5.6981], [22.5234, -5.568], [22.4419, -5.4426], [22.3565, -5.3225], [22.267, -5.2081], [22.173, -5.1002], [22.0738, -5.0], [21.9669, -4.9113], [20.8924, -4.2139]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[21.2955, -3.5156], [22.4368, -4.0975], [22.567, -4.1457], [22.7034, -4.1815], [22.8439, -4.209], [22.9877, -4.2293], [23.1344, -4.2432], [23.2837, -4.2511], [23.4353, -4.2533], [23.5889, -4.2501], [23.7445, -4.2416], [23.9018, -4.228], [24.1084, -3.7292], [24.0068, -3.6083], [23.9028, -3.4923], [23.7964, -3.3813], [23.6877, -3.2758], [23.5765, -3.1758], [23.463, -3.0819], [23.3469, -2.9945], [23.2282, -2.9146], [23.1064, -2.8435], [22.9802, -2.7855], [21.7618, -2.3899]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[21.9705, -1.6111], [23.2234, -1.8778], [23.3617, -1.8907], [23.5027, -1.89], [23.6455, -1.8801], [23.7897, -1.8625], [23.935, -1.8379], [24.0812, -1.807], [24.2282, -1.7699], [24.3758, -1.727], [24.5239, -1.6786], [24.6723, -1.6246], [24.7428, -1.0894], [24.6134, -0.9989], [24.4829, -0.9137], [24.3514, -0.8341], [24.219, -0.7603], [24.0858, -0.6925], [23.9518, -0.6312], [23.8171, -0.5769], [23.6817, -0.5304], [23.5457, -0.4932], [23.4088, -0.4699], [22.1295, -0.4031]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[22.1295, 0.4031], [23.4088, 0.4699], [23.5457, 0.4932], [23.6817, 0.5304], [23.8171, 0.5769], [23.9518, 0.6312], [24.0858, 0.6925], [24.219, 0.7603], [24.3514, 0.8341], [24.4829, 0.9137], [24.6134, 0.9989], [24.7428, 1.0894], [24.6723, 1.6246], [24.5239, 1.6786], [24.3758, 1.727], [24.2282, 1.7699], [24.0812, 1.807], [23.935, 1.8379], [23.7897, 1.8625], [23.6455, 1.8801], [23.5027, 1.89], [23.3617, 1.8907], [23.2234, 1.8778], [21.9705, 1.6111]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[21.7618, 2.3899], [22.9802, 2.7855], [23.1064, 2.8435], [23.2282, 2.9146], [23.3469, 2.9945], [23.463, 3.0819], [23.5765, 3.1758], [23.6877, 3.2758], [23.7964, 3.3813], [23.9028, 3.4923], [24.0068, 3.6083], [24.1084, 3.7292], [23.9018, 4.228], [23.7445, 4.2416], [23.5889, 4.2501], [23.4353, 4.2533], [23.2837, 4.2511], [23.1344, 4.2432], [22.9877, 4.2293], [22.8439, 4.209], [22.7034, 4.1815], [22.567, 4.1457], [22.4368, 4.0975], [21.2955, 3.5156]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[20.8924, 4.2139], [21.9669, 4.9113], [22.0738, 5.0], [22.173, 5.1002], [22.267, 5.2081], [22.3565, 5.3225], [22.4419, 5.4426], [22.5234, 5.568], [22.6011, 5.6981], [22.6752, 5.8328], [22.7456, 5.9718], [22.8124, 6.1148], [22.4838, 6.5431], [22.3283, 6.5156], [22.1758, 6.4836], [22.0265, 6.4469], [21.8807, 6.4055], [21.7386, 6.3592], [21.6005, 6.3078], [21.4668, 6.251], [21.3382, 6.1881], [21.2157, 6.1182], [21.1024, 6.0379], [20.1506, 5.1805]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[19.5805, 5.7506], [20.4379, 6.7024], [20.5182, 6.8157], [20.5881, 6.9382], [20.651, 7.0668], [20.7078, 7.2005], [20.7592, 7.3386], [20.8055, 7.4807], [20.8469, 7.6265], [20.8836, 7.7758], [20.9156, 7.9283], [20.9431, 8.0838], [20.5148, 8.4124], [20.3718, 8.3456], [20.2328, 8.2752], [20.0981, 8.2011], [19.968, 8.1234], [19.8426, 8.0419], [19.7225, 7.9565], [19.6081, 7.867], [19.5002, 7.773], [19.4, 7.6738], [19.3113, 7.5669], [18.6139, 6.4924]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[17.9156, 6.8955], [18.4975, 8.0368], [18.5457, 8.167], [18.5815, 8.3034], [18.609, 8.4439], [18.6293, 8.5877], [18.6432, 8.7344], [18.6511, 8.8837], [18.6533, 9.0353], [18.6501, 9.1889], [18.6416, 9.3445], [18.628, 9.5018], [18.1292, 9.7084], [18.0083, 9.6068], [17.8923, 9.5028], [17.7813, 9.3964], [17.6758, 9.2877], [17.5758, 9.1765], [17.4819, 9.063], [17.3945, 8.9469], [17.3146, 8.8282], [17.2435, 8.7064], [17.1855, 8.5802], [16.7899, 7.3618]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[16.0111, 7.5705], [16.2778, 8.8234], [16.2907, 8.9617], [16.29, 9.1027], [16.2801, 9.2455], [16.2625, 9.3897], [16.2379, 9.535], [16.207, 9.6812], [16.1699, 9.8282], [16.127, 9.9758], [16.0786, 10.1239], [16.0246, 10.2723], [15.4894, 10.3428], [15.3989, 10.2134], [15.3137, 10.0829], [15.2341, 9.9514], [15.1603, 9.819], [15.0925, 9.6858], [15.0312, 9.5518], [14.9769, 9.4171], [14.9304, 9.2817], [14.8932, 9.1457], [14.8699, 9.0088], [14.8031, 7.7295]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[13.9969, 7.7295], [13.9301, 9.0088], [13.9068, 9.1457], [13.8696, 9.2817], [13.8231, 9.4171], [13.7688, 9.5518], [13.7075, 9.6858], [13.6397, 9.819], [13.5659, 9.9514], [13.4863, 10.0829], [13.4011, 10.2134], [13.3106, 10.3428], [12.7754, 10.2723], [12.7214, 10.1239], [12.673, 9.9758], [12.6301, 9.8282], [12.593, 9.6812], [12.5621, 9.535], [12.5375, 9.3897], [12.5199, 9.2455], [12.51, 9.1027], [12.5093, 8.9617], [12.5222, 8.8234], [12.7889, 7.5705]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[12.0101, 7.3618], [11.6145, 8.5802], [11.5565, 8.7064], [11.4854, 8.8282], [11.4055, 8.9469], [11.3181, 9.063], [11.2242, 9.1765], [11.1242, 9.2877], [11.0187, 9.3964], [10.9077, 9.5028], [10.7917, 9.6068], [10.6708, 9.7084], [10.172, 9.5018], [10.1584, 9.3445], [10.1499, 9.1889], [10.1467, 9.0353], [10.1489, 8.8837], [10.1568, 8.7344], [10.1707, 8.5877], [10.191, 8.4439], [10.2185, 8.3034], [10.2543, 8.167], [10.3025, 8.0368], [10.8844, 6.8955]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[10.1861, 6.4924], [9.4887, 7.5669], [9.4, 7.6738], [9.2998, 7.773], [9.1919, 7.867], [9.0775, 7.9565], [8.9574, 8.0419], [8.832, 8.1234], [8.7019, 8.2011], [8.5672, 8.2752], [8.4282, 8.3456], [8.2852, 8.4124], [7.8569, 8.0838], [7.8844, 7.9283], [7.9164, 7.7758], [7.9531, 7.6265], [7.9945, 7.4807], [8.0408, 7.3386], [8.0922, 7.2005], [8.149, 7.0668], [8.2119, 6.9382], [8.2818, 6.8157], [8.3621, 6.7024], [9.2195, 5.7506]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[8.6494, 5.1805], [7.6976, 6.0379], [7.5843, 6.1182], [7.4618, 6.1881], [7.3332, 6.251], [7.1995, 6.3078], [7.0614, 6.3592], [6.9193, 6.4055], [6.7735, 6.4469], [6.6242, 6.4836], [6.4717, 6.5156], [6.3162, 6.5431], [5.9876, 6.1148], [6.0544, 5.9718], [6.1248, 5.8328], [6.1989, 5.6981], [6.2766, 5.568], [6.3581, 5.4426], [6.4435, 5.3225], [6.533, 5.2081], [6.627, 5.1002], [6.7262, 5.0], [6.8331, 4.9113], [7.9076, 4.2139]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[7.5045, 3.5156], [6.3632, 4.0975], [6.233, 4.1457], [6.0966, 4.1815], [5.9561, 4.209], [5.8123, 4.2293], [5.6656, 4.2432], [5.5163, 4.2511], [5.3647, 4.2533], [5.2111, 4.2501], [5.0555, 4.2416], [4.8982, 4.228], [4.6916, 3.7292], [4.7932, 3.6083], [4.8972, 3.4923], [5.0036, 3.3813], [5.1123, 3.2758], [5.2235, 3.1758], [5.337, 3.0819], [5.4531, 2.9945], [5.5718, 2.9146], [5.6936, 2.8435], [5.8198, 2.7855], [7.0382, 2.3899]], y: [-0.8, 0.8], collide: 2}
      - {kind: poly, points: [[6.8295, 1.6111], [5.5766, 1.8778], [5.4383, 1.8907], [5.2973, 1.89], [5.1545, 1.8801], [5.0103, 1.8625], [4.865, 1.8379], [4.7188, 1.807], [4.5718, 1.7699], [4.4242, 1.727], [4.2761, 1.6786], [4.1277, 1.6246], [4.0572, 1.0894], [4.1866, 0.9989], [4.3171, 0.9137], [4.4486, 0.8341], [4.581, 0.7603], [4.7142, 0.6925], [4.8482, 0.6312], [4.9829, 0.5769], [5.1183, 0.5304], [5.2543, 0.4932], [5.3912, 0.4699], [6.6705, 0.4031]], y: [-0.8, 0.8], collide: 2}
  - id: conrod
    shape: part
    pos: [20.4, 0, -0.0]
    mount: gear
    mass: 0.1
    color: "#c4baa2"
    pieces:
      - {kind: poly, points: [[20.4, 0.7], [50.4, 0.7], [50.4, -0.7], [20.4, -0.7]], y: [-2.9, -2.0], collide: 0, color: "#c4baa2"}
      - {kind: disc, center: [20.4, -0.0], radius: 1.1, inner: 0.35, y: [-2.9, -2.0]}
      - {kind: disc, center: [50.4, 0.0], radius: 1.1, inner: 0.35, y: [-2.9, -2.0]}
  - id: bar
    shape: part
    pos: [50.4, 0, 0.0]
    mass: 0.2
    color: "#b9a98a"
    pieces:
      - {kind: poly, points: [[50.4, -0.8], [116.4, -0.8], [116.4, 0.8], [50.4, 0.8]], y: [-3.8, -2.9], collide: 0, color: "#b9a98a"}
      - {kind: disc, center: [50.4, 0.0], radius: 1.1, inner: 0.35, y: [-3.8, -2.0], color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#9b917c"
    pieces:
      - {kind: poly, points: [[62.0, -5.0], [66.0, -5.0], [66.0, 5.0], [62.0, 5.0]], y: [-4.4, -2.9], collide: 0, color: "#9b917c"}
      - {kind: poly, points: [[74.0, -5.0], [78.0, -5.0], [78.0, 5.0], [74.0, 5.0]], y: [-4.4, -2.9], collide: 0, color: "#9b917c"}
      - {kind: poly, points: [[61.0, -5.8], [79.0, -5.8], [79.0, -5.0], [61.0, -5.0]], y: [-4.4, -2.9], collide: 0, color: "#7e7664"}
joints:
  - {id: j_d, type: hinge, body: disc, axis: [0, 1, 0], damping: 0.002}   # the one driven joint; + : clockwise
  - {id: j_g, type: hinge, body: gear, axis: [0, 1, 0], damping: 0.002}   # the spur gear on its pin in the disc
  - {id: j_r, type: hinge, body: conrod, axis: [0, 1, 0], damping: 0.002}
  - {id: j_b, type: slide, body: bar, axis: [1, 0, 0], damping: 0.05}   # the traversing guide-bar; + : to the right
pins:
  - {id: pin_b, a: conrod, b: bar, at: [50.4, 0, 0.0]}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_d, kind: velocity, rpm: 15.0, kv: 2.0, max_torque: 0.2}
checks:
  - {type: ratio, out: j_g, in: j_d, expect: 0.5, tol: 0.02, settle_s: 1, window_s: 6}
  - {type: follow, out: j_b, in: j_d, expect: -0.2448, tol: 0.0122, min_r2: 0.97, settle_s: 0.3, window_s: 0.7}
  - {type: follow, out: j_b, in: j_d, expect: 0.1263, tol: 0.0063, min_r2: 0.97, settle_s: 2.4, window_s: 0.7}
  - {type: follow, out: j_b, in: j_d, expect: -0.1259, tol: 0.0063, min_r2: 0.97, settle_s: 5.1, window_s: 0.7}
  - {type: follow, out: j_b, in: j_d, expect: 0.253, tol: 0.0126, min_r2: 0.97, settle_s: 7.2, window_s: 0.7}
  - {type: follow, out: j_b, in: j_d, expect: -0.253, tol: 0.0126, min_r2: 0.97, settle_s: 8.4, window_s: 0.7}
  - {type: position, joint: j_b, min: -37.713, max: 0.4, settle_s: 0.0, window_s: 8.6}
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [38.0, 0, -3.0], position: [38.0, -150.0, -3.0], fov: 34}
display:
  output: j_b
  labels: {j_d: "Disc (driver)", j_g: "Spur gear", j_b: "Guide-bar"}
  proof: {label: "Connecting rod unpinned", sub: "the disc and spur gear turn but the guide-bar stands still"}

