/*
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 * as tslib_1 from "tslib";
import { Base, Point_$type, markType } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
/**
 * @hidden
 */
var RadialAxes = /** @class */ (function (_super) {
    tslib_1.__extends(RadialAxes, _super);
    function RadialAxes(a, b) {
        var _this = _super.call(this) || this;
        _this.b = null;
        _this.a = null;
        _this.h = { $type: Point_$type, x: 0.5, y: 0.5 };
        _this.b = a;
        _this.a = b;
        return _this;
    }
    RadialAxes.prototype.d = function (a, b, c, d) {
        var e = this.h.x + (b * Math.cos(a));
        return ViewportUtils.c(e, c, d);
    };
    RadialAxes.prototype.f = function (a, b, c, d, e, f, g) {
        var h = Math.min(b != null ? b.count : 0, c != null ? c.count : 0);
        var i = false;
        if (a.count == h) {
            i = true;
        }
        var j;
        var k;
        var l = this.h.x;
        var m = this.h.y;
        var n;
        var o;
        for (var p = 0; p < h; p++) {
            j = this.a.getScaledAngle(b.item(p));
            k = this.b.lp(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 });
            }
        }
    };
    RadialAxes.prototype.g = function (a, b, c, d, e, f) {
        var g = ViewportUtils.a(a, c, d);
        var h = ViewportUtils.e(b, c, d);
        var i = Math.sqrt(Math.pow(g - this.h.x, 2) + Math.pow(h - this.h.y, 2));
        var 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.lr(i);
        return {
            p4: e,
            p5: f
        };
    };
    RadialAxes.prototype.e = function (a, b, c, d) {
        var e = this.h.y + (b * Math.sin(a));
        return ViewportUtils.f(e, c, d);
    };
    RadialAxes.prototype.c = function (a) {
        var b = Math.sqrt(Math.pow(a.x - this.h.x, 2) + Math.pow(a.y - this.h.y, 2));
        var 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;
}(Base));
export { RadialAxes };
//# sourceMappingURL=RadialAxes.js.map