we want to prevent excessive spinning in rotations
551274
function getNormalizeRotations(start, end) {
  // normalize both rotations
  var normStart = normalizeRotation(start)
  var normEnd = normalizeRotation(end)
  // find the shortest arc for each rotation
  Object.keys(start).forEach(function(axis) {
    if (normEnd[axis] - normStart[axis] > 180) normEnd[axis] -= 360
  })
  return { start: normStart, end: normEnd }
}
334018
def stop(self):
        """"""

        self._target = self.position

        self.log.info('Stopping movement after user request.')

        return self.target, self.position
233021
public void setRotation(String rotation) {
        if (rotation != null) {
            try {
                setRotation(Integer.parseInt(rotation));
            } catch (NumberFormatException e) {
                setRotation(-1);
            }
        }
    }
949161
function () {
        var position = this.position;
        var rotation = this.rotation;
        var scale = this.scale;

        if (this.transformNeedsUpdate()) {
            var m = this.localTransform.array;

            // Transform order, scale->rotation->position
            mat4.fromRotationTranslation(m, rotation.array, position.array);

            mat4.scale(m, m, scale.array);

            rotation._dirty = false;
            scale._dirty = false;
            position._dirty = false;

            this._needsUpdateWorldTransform = true;
        }
    }
1167037
def _handle_log_rotations(self):
        '''  '''
        for h in self.capture_handlers:
            if self._should_rotate_log(h):
                self._rotate_log(h)
455906
def iprotate(l, steps=1):
    

    """
    if len(l):
        steps %= len(l)
        if steps:
            firstPart = l[:steps]
            del l[:steps]
            l.extend(firstPart)
    return l
1236305
function _doRotate() {
    _this.rotate(file, options, function(err, rotated) {
      if (err) {
        _this.emit('error', err);
        return;
      }
      if (rotated) {
        _this.emit('rotate', file);
      }
    });
  }
155287
function () {
    var body = this.body;
    var el = this.el;
    el.setAttribute('position', body.position);
    el.setAttribute('rotation', {
      x: deg(body.quaternion.x),
      y: deg(body.quaternion.y),
      z: deg(body.quaternion.z)
    });
  }
562354
def rotationType(self, value):
        """"""
        if self._rotationType.lower() in self._rotationTypes and \
           self._rotationType != value:
            self._rotationType = value
330646
def _update_rotation(self, event):
        """"""
        p1 = event.mouse_event.press_event.pos
        p2 = event.mouse_event.pos
        if self._event_value is None:
            self._event_value = self.azimuth, self.elevation
        self.azimuth = self._event_value[0] - (p2 - p1)[0] * 0.5
        self.elevation = self._event_value[1] + (p2 - p1)[1] * 0.5
1118561
def _turn(self, speed, degrees, brake=True, block=True):
        

        # The distance each wheel needs to travel
        distance_mm = (abs(degrees) / 360) * self.circumference_mm

        # The number of rotations to move distance_mm
        rotations = distance_mm/self.wheel.circumference_mm

        log.debug("%s: turn() degrees %s, distance_mm %s, rotations %s, degrees %s" %
            (self, degrees, distance_mm, rotations, degrees))

        # If degrees is positive rotate clockwise
        if degrees > 0:
            MoveTank.on_for_rotations(self, speed, speed * -1, rotations, brake, block)

        # If degrees is negative rotate counter-clockwise
        else:
            rotations = distance_mm / self.wheel.circumference_mm
            MoveTank.on_for_rotations(self, speed * -1, speed, rotations, brake, block)
671004
def rotation2(AHRS2):
    ''''''
    r = Matrix3()
    r.from_euler(AHRS2.roll, AHRS2.pitch, AHRS2.yaw)
    return r
1038859
function () {
        return new Promise(function (resolve, reject) {
            var rotations = [];
            for (var i = 0; i < spotlightRotations.length; i++) {
                var now = new Date();
                var daysToAdd = 3 * i;
                now.setDate(now.getDate() + daysToAdd);

                var currentSpotlight = Math.floor((((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length)) / 3);
                var daysUntilNext = (3 - ((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length) % 3) + daysToAdd;
                var start = new Date();
                start.setDate(start.getDate() + (daysUntilNext - 3));

                var obj = {
                    rotation: spotlightRotations[currentSpotlight],
                    daysUntilNext: daysUntilNext,
                    startDate: start
                };
                rotations.push(obj);
            }
            resolve(rotations);
        });
    }
1053218
function _adjustChildren(children) {
  children.forEach(function (child) {
    child.rotation = _getWorldRotationFromLocalRotation(child);
    child.position = _getWorldPositionFromLocalPosition(child);
  });
}
791430
function() {
    this.jsonInit({
      "message0": Blockly.Msg.MOTION_SETROTATIONSTYLE,
      "args0": [
        {
          "type": "field_dropdown",
          "name": "STYLE",
          "options": [
            [Blockly.Msg.MOTION_SETROTATIONSTYLE_LEFTRIGHT, 'left-right'],
            [Blockly.Msg.MOTION_SETROTATIONSTYLE_DONTROTATE, 'don\'t rotate'],
            [Blockly.Msg.MOTION_SETROTATIONSTYLE_ALLAROUND, 'all around']
          ]
        }
      ],
      "category": Blockly.Categories.motion,
      "extensions": ["colours_motion", "shape_statement"]
    });
  }
867481
private static void disableSpinnerDragging(JSpinner spinner)
    {
        int n = spinner.getComponentCount();
        for (int i=0; i<n; i++)
        {
            Component c = spinner.getComponent(i);
            String name = c.getName();
            if ("Spinner.nextButton".equals(name) ||
                "Spinner.previousButton".equals(name))
            {
                MouseMotionListener mouseMotionListeners[] =
                    c.getMouseMotionListeners();
                for (MouseMotionListener m : mouseMotionListeners)
                {
                    if (m instanceof SpinnerDraggingHandler)
                    {
                        c.removeMouseMotionListener(m);
                    }
                }
                MouseListener mouseListeners[] =
                    c.getMouseListeners();
                for (MouseListener m : mouseListeners)
                {
                    if (m instanceof SpinnerDraggingHandler)
                    {
                        c.removeMouseListener(m);
                    }
                }
            }
        }
    }
291456
public void rotate(Quaternion rotation) {
		Transform3D m = new Transform3D();
		m.transform(this.getFirstAxis());
		m.transform(this.getSecondAxis());
		m.transform(this.getThirdAxis());
		this.setFirstAxisExtent(this.getFirstAxis().length());
		this.setSecondAxisExtent(this.getSecondAxis().length());
		this.setThirdAxisExtent(this.getThirdAxis().length());
		this.getFirstAxis().normalize();
		this.getSecondAxis().normalize();
		this.getThirdAxis().normalize();
	}