{
  "id": "rotation",
  "version": "588e6a4ce2c8",
  "status": "published",
  "name": "Rotation Calculator",
  "question": "Where do points go in a rotation?",
  "summary": "Rotates points in the coordinate plane by any angle, counterclockwise or clockwise, about the origin or any centre, with exact answers for 90°, 180° and 270° and the working.",
  "category": "math",
  "subcategory": "geometry",
  "url": "https://www.acalculator.org/math/rotation-calculator",
  "markdown": "https://www.acalculator.org/math/rotation-calculator.md",
  "kind": "function",
  "method": "x′ = cx + (x − cx)cos θ − (y − cy)sin θ, y′ = cy + (x − cx)sin θ + (y − cy)cos θ, with θ counterclockwise; clockwise is −θ.",
  "assumptions": [
    "The angle is reduced to a counterclockwise turn from 0° up to 360° before rotating.",
    "A multiple of 90° is exact: typed decimals are read exactly and each coordinate is rounded once to 10 significant figures.",
    "Any other angle uses double-precision cos and sin; a coordinate within 10⁻¹² of the figure’s size from 0 shows as 0."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "angle": {
        "title": "Angle (degrees)",
        "description": "How far to turn each point about the centre, in degrees.",
        "type": "number",
        "minimum": -1000000000,
        "maximum": 1000000000
      },
      "dir": {
        "title": "Direction",
        "description": "Counterclockwise (the usual positive direction) or clockwise.",
        "type": "string",
        "enum": [
          "ccw",
          "cw"
        ]
      },
      "cx": {
        "title": "Centre x",
        "description": "The x coordinate of the centre of rotation; 0 when left empty.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "cy": {
        "title": "Centre y",
        "description": "The y coordinate of the centre of rotation; 0 when left empty.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "points": {
        "title": "Points",
        "description": "The points of the figure to rotate, A, B, C and so on, up to 12.",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "x": {
              "title": "x",
              "description": "The x coordinate of the point.",
              "type": "number",
              "minimum": -1000000000000,
              "maximum": 1000000000000
            },
            "y": {
              "title": "y",
              "description": "The y coordinate of the point.",
              "type": "number",
              "minimum": -1000000000000,
              "maximum": 1000000000000
            }
          }
        }
      }
    }
  },
  "outputs": {
    "image": {
      "label": "Image points",
      "description": "Each point after the rotation, as A′(x, y); B′(x, y) and so on.",
      "format": "text"
    },
    "turn": {
      "label": "Counterclockwise turn",
      "description": "The same rotation as a counterclockwise angle from 0° up to 360°.",
      "format": "number"
    },
    "rule": {
      "label": "Rule about the centre",
      "description": "Where a point goes, measured from the centre: exact for a multiple of 90°.",
      "format": "text"
    },
    "steps": {
      "label": "Working",
      "description": "For each point, x′ = cx + (x − cx)cos θ − (y − cy)sin θ and y′ = cy + (x − cx)sin θ + (y − cy)cos θ.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "angle": 90,
      "dir": "ccw",
      "cx": 0,
      "cy": 0,
      "points": [
        {
          "x": 3,
          "y": 2
        },
        {
          "x": 5,
          "y": 2
        },
        {
          "x": 4,
          "y": 6
        }
      ]
    },
    "outputs": {
      "image": "A′(−2, 3); B′(−2, 5); C′(−6, 4)",
      "turn": 90,
      "rule": "(x, y) → (−y, x)",
      "steps": "centre (0, 0), counterclockwise turn 90°; (x, y) → (−y, x) about the centre; A(3, 2) → A′(−2, 3); B(5, 2) → B′(−2, 5); C(4, 6) → C′(−6, 4)"
    },
    "text": "The image points are A′(−2, 3); B′(−2, 5); C′(−6, 4)."
  },
  "examples": [
    {
      "given": {
        "angle": 90,
        "dir": "ccw",
        "points": [
          {
            "x": 3,
            "y": 2
          }
        ]
      },
      "expect": {
        "image": "A′(−2, 3)",
        "rule": "(x, y) → (−y, x)",
        "turn": 90
      },
      "source": "CK-12 Foundation, Geometry, 8.11 Rotation Rules (counterclockwise about the origin: 90° (x, y) → (−y, x), 180° (−x, −y), 270° (y, −x); (3, 2) turned 90° is (−2, 3)), https://k12.libretexts.org/Bookshelves/Mathematics/Geometry/08%3A_Rigid_Transformations/8.11%3A_Rotation_Rules (retrieved 2026-10-05)"
    },
    {
      "given": {
        "angle": 270,
        "dir": "ccw",
        "points": [
          {
            "x": -2,
            "y": 6
          }
        ]
      },
      "expect": {
        "image": "A′(6, 2)"
      },
      "source": "CK-12 Foundation, Geometry, 8.11 Rotation Rules (counterclockwise about the origin: 90° (x, y) → (−y, x), 180° (−x, −y), 270° (y, −x); (3, 2) turned 90° is (−2, 3)), https://k12.libretexts.org/Bookshelves/Mathematics/Geometry/08%3A_Rigid_Transformations/8.11%3A_Rotation_Rules (retrieved 2026-10-05): J(−2, 6) to J′(6, 2) is the 270° rule"
    },
    {
      "given": {
        "angle": 90,
        "dir": "cw",
        "cx": 1,
        "cy": 1,
        "points": [
          {
            "x": 3,
            "y": 2
          }
        ]
      },
      "expect": {
        "image": "A′(2, −1)",
        "turn": 270
      },
      "source": "hand calculation in content.mdx: 90° clockwise is 270° counterclockwise; (2, 1) from the centre → (1, −2), plus (1, 1)"
    },
    {
      "given": {
        "angle": 45,
        "dir": "ccw",
        "points": [
          {
            "x": 2,
            "y": 0
          }
        ]
      },
      "expect": {
        "image": "A′(1.414213562, 1.414213562)",
        "turn": 45
      },
      "source": "hand calculation in content.mdx: (2cos 45°, 2sin 45°) = (√2, √2); OpenStax, Algebra and Trigonometry 2e, §12.4 Rotation of Axes (x = x′cos θ − y′sin θ, y = x′sin θ + y′cos θ), https://openstax.org/books/algebra-and-trigonometry-2e/pages/12-4-rotation-of-axes (retrieved 2026-10-05)"
    },
    {
      "given": {
        "angle": -450,
        "dir": "ccw",
        "points": [
          {
            "x": 0.1,
            "y": 0.2
          }
        ]
      },
      "expect": {
        "image": "A′(0.2, −0.1)",
        "turn": 270
      },
      "source": "hand calculation in content.mdx: −450° is 270° counterclockwise, (x, y) → (y, −x)"
    }
  ],
  "sources": [
    "CK-12 Foundation, Geometry, 8.11 Rotation Rules (counterclockwise rules for 90°, 180° and 270° about the origin; (3, 2) turned 90° is (−2, 3); J(−2, 6) to J′(6, 2) by 270°), on K12 LibreTexts. https://k12.libretexts.org/Bookshelves/Mathematics/Geometry/08%3A_Rigid_Transformations/8.11%3A_Rotation_Rules (retrieved 2026-10-05)",
    "OpenStax, Algebra and Trigonometry 2e, §12.4 Rotation of Axes (x = x′cos θ − y′sin θ, y = x′sin θ + y′cos θ), CC BY 4.0. https://openstax.org/books/algebra-and-trigonometry-2e/pages/12-4-rotation-of-axes (retrieved 2026-10-05)"
  ],
  "related": [
    "reflection",
    "dilation",
    "polar-coordinates",
    "midpoint"
  ],
  "changelog": []
}
