import oc from "../opencascade/initializer";
import {Solid} from "../modeling";
import {Plane, Vector} from "../math";
/**
* Creates a 3D torus solid based on the specified parameters.
* @memberof primitives-3D
* @alias Torus
* @param {Object} parameters - The parameters for the torus.
* @param {Plane} [parameters.plane=Plane.XY] - The plane in which the torus is constructed.
* @param {Vector} [parameters.center=Vector.ZERO] - The center of the torus.
* @param {number} parameters.majorRadius - The major radius of the torus (distance from the center to the middle of the tube).
* @param {number} parameters.minorRadius - The minor radius of the torus (radius of the tube).
* @returns {Solid} A `Solid` object representing the constructed torus.
*/
const Torus = ({plane = Plane.XY, center = Vector.ZERO, majorRadius, minorRadius}) => {
const axis = plane.wrapped.Position().Ax2();
const localOffset = plane.toWorldCoordinates(center.wrapped);
return new Solid(new oc.BRepPrimAPI_MakeTorus_5(axis, majorRadius, minorRadius).Shape()).translate(new Vector({wrapped: localOffset}));
};
export {Torus};