public static double GetRotationAngle(Vector3D axis, Vector3D startNormal, Vector3D endNormal)
 {
     if (startNormal.IsSame(endNormal))
     return Direction.Zero;
      if (startNormal.IsSame(-endNormal))
     return Direction.Twice;
      var cross = startNormal.Cross(axis);
      return cross.IsSame(endNormal) ? Direction.Clockwise : Direction.CounterClockwise;
 }
 public static double GetRotationAngle(Vector3D axis, Vector3D startNormal, Vector3D endNormal)
 {
     if (startNormal.IsSame(endNormal))
     return 0;
      if (startNormal.IsSame(-endNormal))
     return 180;
      var cross = startNormal.Cross(axis);
      return cross.IsSame(endNormal) ? 90 : -90;
 }
 public void Rotate(Vector3D axis, double angle)
 {
     _rotateCount++;
      _turnCount++;
      if (angle == 180)
     _turnCount++;
      if (!axis.IsSame(_previousAxis))
     _axisCount++;
      _previousAxis = axis;
      _writer.WriteLine("{0}: Turns={1} AxisChanges={2} Angle={3} Axis={4}",
     _rotateCount, _turnCount, _axisCount, angle, axis);
 }
Beispiel #4
0
 protected void RotateCube(Vector3D normal)
 {
     var angle = GetAngleToRotateCube(normal);
      if (angle != 0)
     Rotator.RotateCube(Directions.Up, angle);
      Assert(normal.IsSame(Directions.Front));
 }
Beispiel #5
0
 protected double GetAngleToRotateCube(Vector3D normal)
 {
     if (normal.IsSame(Directions.Front))
     return 0;
      if (normal.IsSame(Directions.Right))
     return 90;
      if (normal.IsSame(Directions.Left))
     return -90;
      return 180;
 }