# No. 485 (Brown 1868): "Common wind-mill, illustrating the production of circular motion by the direct action of the wind upon the oblique sails."
# Model (cm). A round tower (20 cm across at the foot) with a dome cap and a tail vane; four sails, 23 cm long, on a
# shaft along x out of the cap. Each sail is slanted 18 degrees out of the plane it turns in. The wind (2.5 m/s)
# blows along the shaft onto the sails; MuJoCo's fluid forces (openspec add-air-wind: the ellipsoid model on the sails -- drag,
# lift from their slant) push them round against the millstones' load (0.003 N m s). The wind is the only input (nothing is
# driven). Generator: opencode-runs/air/gen485.py.
number: 485
slug: common-wind-mill
name: Common wind-mill
brown: "Common wind-mill, illustrating the production of circular motion by the direct action of the wind upon the oblique sails."
units: cm
sim:
  timestep: 0.001
  integrator: implicitfast
  iterations: 50
  duration_s: 10
  floor: false
air: {density: 1.2, viscosity: 1.8e-5, wind: [2.5, 0, 0]}
bodies:
  - id: tower
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#ece4d0"
    pieces:
      - {kind: loft, a: [[10, 0, 0], [9.2388, 3.8268, 0], [7.0711, 7.0711, 0], [3.8268, 9.2388, 0], [0, 10, 0], [-3.8268, 9.2388, 0], [-7.0711, 7.0711, 0], [-9.2388, 3.8268, 0], [-10, 0, 0], [-9.2388, -3.8268, 0], [-7.0711, -7.0711, 0], [-3.8268, -9.2388, 0], [-0, -10, 0], [3.8268, -9.2388, 0], [7.0711, -7.0711, 0], [9.2388, -3.8268, 0]], b: [[7.2, 0, 30], [6.6519, 2.7553, 30], [5.0912, 5.0912, 30], [2.7553, 6.6519, 30], [0, 7.2, 30], [-2.7553, 6.6519, 30], [-5.0912, 5.0912, 30], [-6.6519, 2.7553, 30], [-7.2, 0, 30], [-6.6519, -2.7553, 30], [-5.0912, -5.0912, 30], [-2.7553, -6.6519, 30], [-0, -7.2, 30], [2.7553, -6.6519, 30], [5.0912, -5.0912, 30], [6.6519, -2.7553, 30]], collide: 0}   # the tower
      - {kind: loft, a: [[7.6, 0, 30], [7.0215, 2.9084, 30], [5.374, 5.374, 30], [2.9084, 7.0215, 30], [0, 7.6, 30], [-2.9084, 7.0215, 30], [-5.374, 5.374, 30], [-7.0215, 2.9084, 30], [-7.6, 0, 30], [-7.0215, -2.9084, 30], [-5.374, -5.374, 30], [-2.9084, -7.0215, 30], [-0, -7.6, 30], [2.9084, -7.0215, 30], [5.374, -5.374, 30], [7.0215, -2.9084, 30]], b: [[7.6, 0, 31.5], [7.0215, 2.9084, 31.5], [5.374, 5.374, 31.5], [2.9084, 7.0215, 31.5], [0, 7.6, 31.5], [-2.9084, 7.0215, 31.5], [-5.374, 5.374, 31.5], [-7.0215, 2.9084, 31.5], [-7.6, 0, 31.5], [-7.0215, -2.9084, 31.5], [-5.374, -5.374, 31.5], [-2.9084, -7.0215, 31.5], [-0, -7.6, 31.5], [2.9084, -7.0215, 31.5], [5.374, -5.374, 31.5], [7.0215, -2.9084, 31.5]], collide: 0}   # the cap
      - {kind: loft, a: [[7.6, 0, 31.5], [7.0215, 2.9084, 31.5], [5.374, 5.374, 31.5], [2.9084, 7.0215, 31.5], [0, 7.6, 31.5], [-2.9084, 7.0215, 31.5], [-5.374, 5.374, 31.5], [-7.0215, 2.9084, 31.5], [-7.6, 0, 31.5], [-7.0215, -2.9084, 31.5], [-5.374, -5.374, 31.5], [-2.9084, -7.0215, 31.5], [-0, -7.6, 31.5], [2.9084, -7.0215, 31.5], [5.374, -5.374, 31.5], [7.0215, -2.9084, 31.5]], b: [[7, 0, 34.5], [6.4672, 2.6788, 34.5], [4.9497, 4.9497, 34.5], [2.6788, 6.4672, 34.5], [0, 7, 34.5], [-2.6788, 6.4672, 34.5], [-4.9497, 4.9497, 34.5], [-6.4672, 2.6788, 34.5], [-7, 0, 34.5], [-6.4672, -2.6788, 34.5], [-4.9497, -4.9497, 34.5], [-2.6788, -6.4672, 34.5], [-0, -7, 34.5], [2.6788, -6.4672, 34.5], [4.9497, -4.9497, 34.5], [6.4672, -2.6788, 34.5]], collide: 0}
      - {kind: loft, a: [[7, 0, 34.5], [6.4672, 2.6788, 34.5], [4.9497, 4.9497, 34.5], [2.6788, 6.4672, 34.5], [0, 7, 34.5], [-2.6788, 6.4672, 34.5], [-4.9497, 4.9497, 34.5], [-6.4672, 2.6788, 34.5], [-7, 0, 34.5], [-6.4672, -2.6788, 34.5], [-4.9497, -4.9497, 34.5], [-2.6788, -6.4672, 34.5], [-0, -7, 34.5], [2.6788, -6.4672, 34.5], [4.9497, -4.9497, 34.5], [6.4672, -2.6788, 34.5]], b: [[5.6, 0, 37.5], [5.1737, 2.143, 37.5], [3.9598, 3.9598, 37.5], [2.143, 5.1737, 37.5], [0, 5.6, 37.5], [-2.143, 5.1737, 37.5], [-3.9598, 3.9598, 37.5], [-5.1737, 2.143, 37.5], [-5.6, 0, 37.5], [-5.1737, -2.143, 37.5], [-3.9598, -3.9598, 37.5], [-2.143, -5.1737, 37.5], [-0, -5.6, 37.5], [2.143, -5.1737, 37.5], [3.9598, -3.9598, 37.5], [5.1737, -2.143, 37.5]], collide: 0}
      - {kind: loft, a: [[5.6, 0, 37.5], [5.1737, 2.143, 37.5], [3.9598, 3.9598, 37.5], [2.143, 5.1737, 37.5], [0, 5.6, 37.5], [-2.143, 5.1737, 37.5], [-3.9598, 3.9598, 37.5], [-5.1737, 2.143, 37.5], [-5.6, 0, 37.5], [-5.1737, -2.143, 37.5], [-3.9598, -3.9598, 37.5], [-2.143, -5.1737, 37.5], [-0, -5.6, 37.5], [2.143, -5.1737, 37.5], [3.9598, -3.9598, 37.5], [5.1737, -2.143, 37.5]], b: [[3.4, 0, 39.5], [3.1412, 1.3011, 39.5], [2.4042, 2.4042, 39.5], [1.3011, 3.1412, 39.5], [0, 3.4, 39.5], [-1.3011, 3.1412, 39.5], [-2.4042, 2.4042, 39.5], [-3.1412, 1.3011, 39.5], [-3.4, 0, 39.5], [-3.1412, -1.3011, 39.5], [-2.4042, -2.4042, 39.5], [-1.3011, -3.1412, 39.5], [-0, -3.4, 39.5], [1.3011, -3.1412, 39.5], [2.4042, -2.4042, 39.5], [3.1412, -1.3011, 39.5]], collide: 0}
      - {kind: loft, a: [[3.4, 0, 39.5], [3.1412, 1.3011, 39.5], [2.4042, 2.4042, 39.5], [1.3011, 3.1412, 39.5], [0, 3.4, 39.5], [-1.3011, 3.1412, 39.5], [-2.4042, 2.4042, 39.5], [-3.1412, 1.3011, 39.5], [-3.4, 0, 39.5], [-3.1412, -1.3011, 39.5], [-2.4042, -2.4042, 39.5], [-1.3011, -3.1412, 39.5], [-0, -3.4, 39.5], [1.3011, -3.1412, 39.5], [2.4042, -2.4042, 39.5], [3.1412, -1.3011, 39.5]], b: [[0.6, 0, 40.4], [0.5543, 0.2296, 40.4], [0.4243, 0.4243, 40.4], [0.2296, 0.5543, 40.4], [0, 0.6, 40.4], [-0.2296, 0.5543, 40.4], [-0.4243, 0.4243, 40.4], [-0.5543, 0.2296, 40.4], [-0.6, 0, 40.4], [-0.5543, -0.2296, 40.4], [-0.4243, -0.4243, 40.4], [-0.2296, -0.5543, 40.4], [-0, -0.6, 40.4], [0.2296, -0.5543, 40.4], [0.4243, -0.4243, 40.4], [0.5543, -0.2296, 40.4]], collide: 0}
      - {kind: rod, from: [0, 0, 40], to: [0, 0, 41.6], radius: 0.7, collide: 0}   # its knob
      - {kind: loft, a: [[-1.5, -9.9, 0], [1.5, -9.9, 0], [1.5, -9.9, 4.5], [0, -9.9, 6], [-1.5, -9.9, 4.5]], b: [[-1.5, -9.8, 0], [1.5, -9.8, 0], [1.5, -9.8, 4.5], [0, -9.8, 6], [-1.5, -9.8, 4.5]], collide: 0, color: "#2a2520"}   # the door
      - {kind: loft, a: [[-3.3, -8.3, 18], [-1.9, -8.3, 18], [-1.9, -8.3, 21], [-2.6, -8.3, 21.7], [-3.3, -8.3, 21]], b: [[-3.3, -8.2, 18], [-1.9, -8.2, 18], [-1.9, -8.2, 21], [-2.6, -8.2, 21.7], [-3.3, -8.2, 21]], collide: 0, color: "#2a2520"}
      - {kind: loft, a: [[1.9, -8.3, 18], [3.3, -8.3, 18], [3.3, -8.3, 21], [2.6, -8.3, 21.7], [1.9, -8.3, 21]], b: [[1.9, -8.2, 18], [3.3, -8.2, 18], [3.3, -8.2, 21], [2.6, -8.2, 21.7], [1.9, -8.2, 21]], collide: 0, color: "#2a2520"}
      - {kind: loft, a: [[10, -0.15, 34], [14, -0.15, 35.2], [20, -0.15, 37.5], [26, -0.15, 39], [31, -0.15, 38.6], [34, -0.15, 36.5], [34.5, -0.15, 34], [33, -0.15, 31.6], [29, -0.15, 30.4], [23, -0.15, 31], [16, -0.15, 32.4], [11, -0.15, 33.5]], b: [[10, 0.15, 34], [14, 0.15, 35.2], [20, 0.15, 37.5], [26, 0.15, 39], [31, 0.15, 38.6], [34, 0.15, 36.5], [34.5, 0.15, 34], [33, 0.15, 31.6], [29, 0.15, 30.4], [23, 0.15, 31], [16, 0.15, 32.4], [11, 0.15, 33.5]], collide: 0, color: "#d8d0bc"}   # the tail
      - {kind: rod, from: [5, 0, 33.7], to: [12, 0, 34], radius: 0.4, collide: 0}
      - {kind: loft, a: [[19, 0, -1], [18.3526, 4.9176, -1], [16.4545, 9.5, -1], [13.435, 13.435, -1], [9.5, 16.4545, -1], [4.9176, 18.3526, -1], [0, 19, -1], [-4.9176, 18.3526, -1], [-9.5, 16.4545, -1], [-13.435, 13.435, -1], [-16.4545, 9.5, -1], [-18.3526, 4.9176, -1], [-19, 0, -1], [-18.3526, -4.9176, -1], [-16.4545, -9.5, -1], [-13.435, -13.435, -1], [-9.5, -16.4545, -1], [-4.9176, -18.3526, -1], [-0, -19, -1], [4.9176, -18.3526, -1], [9.5, -16.4545, -1], [13.435, -13.435, -1], [16.4545, -9.5, -1], [18.3526, -4.9176, -1]], b: [[19, 0, 0], [18.3526, 4.9176, 0], [16.4545, 9.5, 0], [13.435, 13.435, 0], [9.5, 16.4545, 0], [4.9176, 18.3526, 0], [0, 19, 0], [-4.9176, 18.3526, 0], [-9.5, 16.4545, 0], [-13.435, 13.435, 0], [-16.4545, 9.5, 0], [-18.3526, 4.9176, 0], [-19, 0, 0], [-18.3526, -4.9176, 0], [-16.4545, -9.5, 0], [-13.435, -13.435, 0], [-9.5, -16.4545, 0], [-4.9176, -18.3526, 0], [-0, -19, 0], [4.9176, -18.3526, 0], [9.5, -16.4545, 0], [13.435, -13.435, 0], [16.4545, -9.5, 0], [18.3526, -4.9176, 0]], collide: 0, color: "#9a9282"}   # the ground
  - id: sails
    shape: part
    pos: [-13, 0, 36]
    density: 600
    color: "#8a7656"
    pieces:
      - {kind: rod, from: [-14.5, 0, 36], to: [-4, 0, 36], radius: 0.8, collide: 0, color: "#7a6a50"}   # the shaft, into the cap
      - {kind: rod, from: [-15.6, 0, 36], to: [-13.6, 0, 36], radius: 2.0, collide: 0, color: "#7a6a50"}   # the hub
      - {kind: loft, a: [[-13.8914, 4.4824, 37.1745], [-12.3463, 1.1199, 40.537], [-12.1086, 1.1745, 40.4824], [-13.6537, 4.537, 37.1199]], b: [[-14.355, 18.9261, 49.6008], [-11.8828, 13.5461, 54.9808], [-11.645, 13.6008, 54.9261], [-14.1172, 18.9808, 49.5461]], collide: 0, sail: true, density: 300, color: "#e6dcc4"}   # a sail (the wind pushes on it)
      - {kind: rod, from: [-13.2853, -0.0656, 36.0656], to: [-13.2853, 16.5515, 52.6826], radius: 0.35, collide: 0, color: "#6b5a40"}   # its whip
      - {kind: rod, from: [-14.1079, 7.4958, 39.8179], to: [-12.3676, 3.7086, 43.6051], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.2421, 11.6769, 43.4149], to: [-12.2335, 7.3057, 47.7862], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.3762, 15.858, 47.012], to: [-12.0993, 10.9028, 51.9673], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.469, 18.7468, 49.4973], to: [-12.0066, 13.388, 54.856], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: loft, a: [[-13.8914, -1.1745, 40.4824], [-12.3463, -4.537, 37.1199], [-12.1086, -4.4824, 37.1745], [-13.6537, -1.1199, 40.537]], b: [[-14.355, -13.6008, 54.9261], [-11.8828, -18.9808, 49.5461], [-11.645, -18.9261, 49.6008], [-14.1172, -13.5461, 54.9808]], collide: 0, sail: true, density: 300, color: "#e6dcc4"}
      - {kind: rod, from: [-13.2853, -0.0656, 35.9344], to: [-13.2853, -16.6826, 52.5515], radius: 0.35, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.1079, -3.8179, 43.4958], to: [-12.3676, -7.6051, 39.7086], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.2421, -7.4149, 47.6769], to: [-12.2335, -11.7862, 43.3057], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.3762, -11.012, 51.858], to: [-12.0993, -15.9673, 46.9028], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.469, -13.4973, 54.7468], to: [-12.0066, -18.856, 49.388], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: loft, a: [[-13.8914, -4.4824, 34.8255], [-12.3463, -1.1199, 31.463], [-12.1086, -1.1745, 31.5176], [-13.6537, -4.537, 34.8801]], b: [[-14.355, -18.9261, 22.3992], [-11.8828, -13.5461, 17.0192], [-11.645, -13.6008, 17.0739], [-14.1172, -18.9808, 22.4539]], collide: 0, sail: true, density: 300, color: "#e6dcc4"}
      - {kind: rod, from: [-13.2853, 0.0656, 35.9344], to: [-13.2853, -16.5515, 19.3174], radius: 0.35, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.1079, -7.4958, 32.1821], to: [-12.3676, -3.7086, 28.3949], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.2421, -11.6769, 28.5851], to: [-12.2335, -7.3057, 24.2138], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.3762, -15.858, 24.988], to: [-12.0993, -10.9028, 20.0327], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.469, -18.7468, 22.5027], to: [-12.0066, -13.388, 17.144], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: loft, a: [[-13.8914, 1.1745, 31.5176], [-12.3463, 4.537, 34.8801], [-12.1086, 4.4824, 34.8255], [-13.6537, 1.1199, 31.463]], b: [[-14.355, 13.6008, 17.0739], [-11.8828, 18.9808, 22.4539], [-11.645, 18.9261, 22.3992], [-14.1172, 13.5461, 17.0192]], collide: 0, sail: true, density: 300, color: "#e6dcc4"}
      - {kind: rod, from: [-13.2853, 0.0656, 36.0656], to: [-13.2853, 16.6826, 19.4485], radius: 0.35, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.1079, 3.8179, 28.5042], to: [-12.3676, 7.6051, 32.2914], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.2421, 7.4149, 24.3231], to: [-12.2335, 11.7862, 28.6943], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.3762, 11.012, 20.142], to: [-12.0993, 15.9673, 25.0972], radius: 0.12, collide: 0, color: "#6b5a40"}
      - {kind: rod, from: [-14.469, 13.4973, 17.2532], to: [-12.0066, 18.856, 22.612], radius: 0.12, collide: 0, color: "#6b5a40"}
joints:
  - {id: j_s, type: hinge, body: sails, axis: [1, 0, 0], damping: 0.003}
driver: {joint: j_s, kind: torque, torque: 0, max_torque: 0.001}   # no hand on it: the wind is the only input
checks:
  - {type: turning, joint: j_s, direction: -1, min_mean: 1.0, min_fraction: 0.9, settle_s: 3.0, window_s: 6}
camera: {target: [-2, 0, 25], position: [-95, -120, 45], fov: 34}
display:
  output: j_s
  labels: {j_s: "Sails"}
