namespace CandyboxPlugin.Recipe
{
    public class CandyParameter
    {
        private Point? _originalPoint;
        public Queue<float[]> Histogram { get; set; } = new Queue<float[]>();
        
        public Point Position { get; set; }
        public int OuterRadius { get; set; }
        public int InnerRadius { get; set; }
        public float Weight { get; set; } = 1;


        public void ResetPoint()
        {
            if (_originalPoint != null)
            {
                Position = _originalPoint.Value;
            }
        }

        public void RotatePoint(Point centerPoint, double angleInRadians)
        {
            _originalPoint = Position;
            double cosTheta = Math.Cos(angleInRadians);
            double sinTheta = Math.Sin(angleInRadians);
            Position = new Point
            {
                X =
                    (int)
                    (cosTheta * (Position.X - centerPoint.X) -
                        sinTheta * (Position.Y - centerPoint.Y) + centerPoint.X),
                Y =
                    (int)
                    (sinTheta * (Position.X - centerPoint.X) +
                     cosTheta * (Position.Y - centerPoint.Y) + centerPoint.Y)
            };
        }

       
    }
}