"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Math_1 = require("./Math");
var Interactor_1 = require("./Interactor");
/**
 * Representation of an IG.GFX attachment point.
 */
var Point = /** @class */ (function () {
    function Point(key, foreign, type, point, 
    /** given in degrees! */
    rotation, enabled, representation) {
        if (enabled === void 0) { enabled = true; }
        if (representation === void 0) { representation = "Standard"; }
        this.key = key;
        this.foreign = foreign;
        this.type = type;
        this.point = point;
        this.rotation = rotation;
        this.enabled = enabled;
        this.representation = representation;
    }
    /**
     * converts the position saved in point into transformedPoint
     * @param position
     * @param rotationYRad y angle given in radians
     * @returns this
     */
    Point.prototype.ConvertForObject = function (position, rotationYRad) {
        this.transformedPoint = {
            x: position.x +
                Math.cos(rotationYRad) * this.point.x +
                Math.sin(rotationYRad) * this.point.z,
            y: position.y + this.point.y,
            z: position.z -
                Math.sin(rotationYRad) * this.point.x +
                Math.cos(rotationYRad) * this.point.z,
        };
        if (this.rotation) {
            var summedYRot = rotationYRad + Math_1.MathUtils.degToRad(this.rotation.y);
            var normalizedsummedYRot = Interactor_1.Interactor.NormalizeRadiant(summedYRot);
            this.rotation.y = Math_1.MathUtils.radToDeg(normalizedsummedYRot);
        }
        return this;
    };
    return Point;
}());
exports.Point = Point;
