public static void Build_RightPolygon(RightPolygonData cicle, double heightScale, AnimationData param) { var points = new SDL.SDL_Point[cicle.N]; double omega = Math.PI * 2 / cicle.N; int i; for (i = 0; i < cicle.N; i++) { points[i].x = (int)Math.Floor((cicle.X0 + cicle.R * Math.Cos(omega * i + cicle.Phi)) * heightScale + param.CiclOffsetX); points[i].y = (int)Math.Floor((cicle.Y0 - cicle.R * Math.Sin(omega * i + cicle.Phi)) * heightScale + param.CiclOffSetY); } cicle.Points = points; }
public static void Build_Rectangle(RectangleData rectangle, double widthScale, double heightScale, AnimationData param) { var tempPoints = new SDL.SDL_Point[4]; int x0 = rectangle.OldPoints[0].x + rectangle.Width / 2; int y0; if (rectangle.OldPoints[0].y > rectangle.OldPoints[3].y) { y0 = rectangle.OldPoints[0].y - rectangle.Height / 2; } else { y0 = rectangle.OldPoints[0].y + rectangle.Height / 2; } for (int i = 0; i < 4; i++) { tempPoints[i].x = (int)Math.Floor((x0 + (rectangle.OldPoints[i].x - x0) * Math.Cos(param.fi) - (rectangle.OldPoints[i].y - y0) * Math.Sin(param.fi) - 20 + param.RectOffsetX) /** widthScale*/); tempPoints[i].y = (int)Math.Floor((y0 + (rectangle.OldPoints[i].x - x0) * Math.Sin(param.fi) + (rectangle.OldPoints[i].y - y0) * Math.Cos(param.fi) + param.RectOffSetY) - 20 /** heightScale*/); } rectangle.Points = tempPoints; }