import oc from "../opencascade/initializer";
import {Solid} from "../modeling";
import {Plane, Vector} from "../math";
/**
* Creates a cuboid based on the specified parameters.
* @memberof primitives-3D
* @alias Cuboid
* @param {Object} parameters - The parameters for the cuboid.
* @param {Plane} [parameters.plane=Plane.XY] - The plane in which the cuboid is constructed.
* @param {Vector} [parameters.center=Vector.ZERO] - The center of the cuboid.
* @param {number} parameters.width - The width of the cuboid (along the X-axis).
* @param {number} parameters.height - The height of the cuboid (along the Y-axis).
* @param {number} parameters.depth - The depth of the cuboid (along the Z-axis).
* @returns {Solid} A `Solid` object representing the constructed cuboid.
*/
const Cuboid = ({plane = Plane.XY, center = Vector.ZERO, width, height, depth}) => {
const axis = plane.wrapped.Position().Ax2();
const localOffset = plane.toWorldCoordinates(center.subtract(new Vector({x: width / 2, y: height / 2, z: depth / 2})).wrapped);
return new Solid(new oc.BRepPrimAPI_MakeBox_5(axis, width, height, depth).Shape()).translate(new Vector({wrapped: localOffset}));
};
export {Cuboid};