/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, Point_$type, markType } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
/**
 * @hidden
 */
export let RadialAxes = /*@__PURE__*/ (() => {
    class RadialAxes extends Base {
        constructor(a, b) {
            super();
            this.b = null;
            this.a = null;
            this.h = { $type: Point_$type, x: 0.5, y: 0.5 };
            this.b = a;
            this.a = b;
        }
        d(a, b, c, d) {
            let e = this.h.x + (b * Math.cos(a));
            return ViewportUtils.c(e, c, d);
        }
        f(a, b, c, d, e, f, g) {
            let h = Math.min(b != null ? b.count : 0, c != null ? c.count : 0);
            let i = false;
            if (a.count == h) {
                i = true;
            }
            let j;
            let k;
            let l = this.h.x;
            let m = this.h.y;
            let n;
            let o;
            for (let p = 0; p < h; p++) {
                j = this.a.getScaledAngle(b.item(p));
                k = this.b.ns(c.item(p));
                n = l + (k * f(p, j));
                o = m + (k * g(p, j));
                n = e.left + e.width * (n - d.left) / d.width;
                o = e.top + e.height * (o - d.top) / d.height;
                if (!i) {
                    a.add({ $type: Point_$type, x: n, y: o });
                }
                else {
                    a.item(p, { $type: Point_$type, x: n, y: o });
                }
            }
        }
        g(a, b, c, d, e, f) {
            let g = ViewportUtils.a(a, c, d);
            let h = ViewportUtils.e(b, c, d);
            let i = Math.sqrt(Math.pow(g - this.h.x, 2) + Math.pow(h - this.h.y, 2));
            let j = Math.acos((g - this.h.x) / i);
            if ((h - this.h.y) < 0) {
                j = (2 * Math.PI) - j;
            }
            e = this.a.getUnscaledAngle(j);
            f = this.b.nu(i);
            return {
                p4: e,
                p5: f
            };
        }
        e(a, b, c, d) {
            let e = this.h.y + (b * Math.sin(a));
            return ViewportUtils.f(e, c, d);
        }
        c(a) {
            let b = Math.sqrt(Math.pow(a.x - this.h.x, 2) + Math.pow(a.y - this.h.y, 2));
            let c = Math.acos((a.x - this.h.x) / b);
            if ((a.y - this.h.y) < 0) {
                c = (2 * Math.PI) - c;
            }
            return c;
        }
    }
    RadialAxes.$t = markType(RadialAxes, 'RadialAxes');
    return RadialAxes;
})();
