import * as Core from "@intelligentgraphics/ig.gfx.core";
import Environment from "../Environment";
/** Class for placing objects in the middle of the room. */
var MiddleOfRoomPlacement = /** @class */ (function () {
    /**
     * The constructor.
     * @param insertedId
     */
    function MiddleOfRoomPlacement(insertedId) {
        this.insertedId = insertedId;
    }
    MiddleOfRoomPlacement.prototype.getTransformation = function () {
        if (!Environment.getInstance().getRoot()) {
            return undefined;
        }
        var tRoomBounds = Core.State.API.GetBounds(Environment.getInstance().getRoot(), "World", true);
        var tObjectBounds = Core.State.API.GetBounds(this.insertedId, "Local", true);
        var middleOfBounds = function (bounds) {
            return Core.Vector.ScalarMultiply3(0.5, Core.Vector.Sub3(bounds.max, bounds.min));
        };
        var position = middleOfBounds(tRoomBounds);
        position = Core.Vector.Sub3(position, middleOfBounds(tObjectBounds));
        position.y = 0;
        return {
            position: position,
            rotation: {
                x: 0,
                y: 0,
                z: 0,
            },
        };
    };
    return MiddleOfRoomPlacement;
}());
export default MiddleOfRoomPlacement;
