import { MathUtils } from "./Math";
import { Interactor } from "./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 + MathUtils.degToRad(this.rotation.y);
            var normalizedsummedYRot = Interactor.NormalizeRadiant(summedYRot);
            this.rotation.y = MathUtils.radToDeg(normalizedsummedYRot);
        }
        return this;
    };
    return Point;
}());
export { Point };
