Better code readability.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 26 Jun 2025 13:57:29 +0000 (16:57 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 26 Jun 2025 13:57:29 +0000 (16:57 +0300)
2D GFX/Presentations/AI/AI demo.bas

index 138ecaa..26664c3 100644 (file)
@@ -374,24 +374,20 @@ skipChar:
     END IF\r
 END SUB\r
 \r
-\r
-SUB RotatePoint (centerX, centerY, pointX, pointY, angleRadians)\r
+SUB RotatePoint (rotationCenterX, rotationCenterY, pointToRotateX, pointToRotateY, rotationAngle)\r
 '\r
-' Rotates point (pointX, pointY) around (centerX, centerY) by angleRadians.\r
-' Standard 2D rotation formula:\r
-'   X' = (X - CX)*cos - (Y - CY)*sin + CX\r
-'   Y' = (X - CX)*sin + (Y - CY)*cos + CY\r
+' Rotates a 2D point around a center using standard rotation formulas.\r
+' X' = (X - CX)*cos - (Y - CY)*sin + CX\r
+' Y' = (X - CX)*sin + (Y - CY)*cos + CY\r
 '\r
-    deltaX = pointX - centerX\r
-    deltaY = pointY - centerY\r
-    sinAngle = SIN(angleRadians)\r
-    cosAngle = COS(angleRadians)\r
-    pointX = deltaX * cosAngle - deltaY * sinAngle + centerX\r
-    pointY = deltaX * sinAngle + deltaY * cosAngle + centerY\r
+    deltaX = pointToRotateX - rotationCenterX\r
+    deltaY = pointToRotateY - rotationCenterY\r
+    sinAngle = SIN(rotationAngle)\r
+    cosAngle = COS(rotationAngle)\r
+    pointToRotateX = deltaX * cosAngle - deltaY * sinAngle + rotationCenterX\r
+    pointToRotateY = deltaX * sinAngle + deltaY * cosAngle + rotationCenterY\r
 END SUB\r
 \r
-\r
-'-------------------------------------------------------------------------------\r
 SUB Scene1\r
 '\r
 ' Loads & processes 3D data from "data.dat" to demonstrate simple line rendering.\r