anchor.diff:                          let normal = Vector3.Normalize (center - positionNext)
                           let reflectedVelocity = Vector3.Reflect (body.LinearVelocity, normal)
                           let linearVelocity = reflectedVelocity * body.Restitution
  -                        { body with LinearVelocity = linearVelocity }
  -                    else body)
  -                    bodies
  +                        body.LinearVelocity <- linearVelocity
  +                    i <- inc i
  +                bodies
               | Box box ->
                   // TODO: implement properly bouncing angles.
  -                SegmentedArray.transform (fun (body : Body) ->
  +                let mutable i = 0
  +                while i < dec bodies.Length do
  +                    let body = &bodies.[i]
                       let positionNext = body.Position + body.LinearVelocity
                       let delta = positionNext - box.Center
                       if Math.isPointInBounds3d positionNext box then
                           let speed = body.LinearVelocity.Magnitude
                           let distanceNormalized = Vector3.Normalize delta
                           let linearVelocity = speed * distanceNormalized * body.Restitution
  -                        { body with LinearVelocity = linearVelocity }
  -                    else body)
  -                    bodies
  +                        body.LinearVelocity <- linearVelocity
  +                    i <- inc i
  +                bodies
               | Constraints constraints ->
                   SegmentedArray.fold (flip constrain) bodies constraints
   
  
positive.code:     module Transformer =
  
          /// Accelerate bodies both linearly and angularly.
          let accelerate bodies =
              SegmentedArray.transform (fun (body : Body) ->
                  { body with Position = body.Position + body.LinearVelocity; Angles = body.Angles + body.AngularVelocity })
                  bodies
  
          /// Constrain bodies.
          let rec constrain c bodies =
              match c with
              | Sphere (radius, center) ->
                  SegmentedArray.transform (fun (body : Body) ->
                      let positionNext = body.Position + body.LinearVelocity
                      let delta = positionNext - center
                      let distanceSquared = delta.MagnitudeSquared
  
negative.code:             fun _ c bodies ->
                  match force with
                  | Gravity gravity ->
                      let mutable i = 0
                      while i < dec bodies.Length do
                          let body = &bodies.[i]
                          body.LinearVelocity <- body.LinearVelocity + gravity
                          i <- inc i
                      (Output.empty, bodies)
                  | Attractor (position, radius, force) ->
                      let mutable i = 0
                      while i < dec bodies.Length do
                          let body = &bodies.[i]
                          let direction = position - body.Position
                          let distance = direction.Magnitude
                          let normal = direction / distance
                          if distance < radius then
                              let pull = (radius - distance) / radius
                              let pullForce = pull * force
                              body.LinearVelocity <- body.LinearVelocity + pullForce * normal
                          i <- inc i
                      (Output.empty, bodies)
                  | Drag (linearDrag, angularDrag) ->
                      let bodies =
  