{
"id": "fn-math-rotate_point",
"dataComponent": "math",
"heading": {
"title": "rotate_point",
"badges": [
"Math",
"Geometry"
]
},
"synopsis": "Rotates a 2D point (x, y) by a specified angle in radians, returning the new coordinates as a float array.",
"codeBlocks": [
"extend(\"math\")\n\n# Rotate point (1, 0) by 90 degrees (π/2 radians):\nres = math:rotate_point(1, 0, 3.14159265359 / 2)\nsput(res)\n# => [0.0, 1.0]\n\n# Rotate (0, 1) by -90 degrees (-π/2 radians):\nres = math:rotate_point(0, 1, -3.14159265359 / 2)\nsput(res)\n# => [1.0, 0.0]\n\n# Usage: math:rotate_point(x, y, angleRad)\n# Returns: [rotatedX, rotatedY]"
],
"notes": [
"Arguments: (x, y, rad)",
"- x: X coordinate (int or float)",
"- y: Y coordinate (int or float)",
"- rad: Angle in radians (float/int). Positive is counterclockwise.",
"Returns: FloatArray [rotatedX, rotatedY].",
"Example: Rotating (1,0) by π/2 radians yields (0,1).",
"Raises an error if arguments are missing or not numeric."
]
}