using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PCUT.Extensions.Transforms
{
    public abstract class SkewTransform : SvgTransform
    {
        protected readonly double _tan;

        public double Degree { get; set; }

        public SkewTransform(double degree)
        {
            Degree = degree;
            var angle = degree * DToRFactor;
            _tan = Math.Tan(angle);
        }
    }

    public class SkewXTransform : SkewTransform
    {
        public SkewXTransform(double degree) : base(degree)
        {
        }

        protected override (double X, double Y) InternalTransform(double x, double y)
        {
            var x1 = x + y * _tan;
            var y1 = y;
            return (x1, y1);
        }
    }

    public class SkewYTransform : SkewTransform
    {
        public SkewYTransform(double degree) : base(degree)
        {
        }

        protected override (double X, double Y) InternalTransform(double x, double y)
        {
            var x1 = x;
            var y1 = y + x * _tan;
            return (x1, y1);
        }
    }
}
