Untitled
unknown
plain_text
a year ago
797 B
2
Indexable
Never
public class ViewModel { public Point CalculateRectangleCenter(double rectangleLeft, double rectangleTop, double rectangleWidth, double rectangleHeight, double rectangleAngleInDegrees) { double rectangleCenterX = rectangleLeft + (rectangleWidth / 2); double rectangleCenterY = rectangleTop + (rectangleHeight / 2); // Adjust the center coordinates based on the rotation angle double angleInRadians = rectangleAngleInDegrees * Math.PI / 180.0; double rotatedCenterX = rectangleCenterX * Math.Cos(angleInRadians) - rectangleCenterY * Math.Sin(angleInRadians); double rotatedCenterY = rectangleCenterX * Math.Sin(angleInRadians) + rectangleCenterY * Math.Cos(angleInRadians); return new Point(rotatedCenterX, rotatedCenterY); } }