primitives-1d_tangent-arc.js
import oc from "../opencascade/initializer";
import {Edge} from "../modeling";
import {Plane, Vector} from "../math";
/**
* Creates an arc between the start and end points with a specified tangent vector at the start point.
* @memberof primitives-1D
* @alias TangentArc
* @param {Object} parameters - The parameters for the arc.
* @param {Plane} [parameters.plane=Plane.XY] - The plane in which the arc is constructed.
* @param {Vector} parameters.start - The start point of the arc.
* @param {Vector} parameters.tangent - The tangent vector at the start point.
* @param {Vector} parameters.end - The end point of the arc.
* @returns {Edge} An `Edge` object representing the constructed arc.
*/
const TangentArc = ({plane = Plane.XY, start, tangent, end}) => {
const globalStart = plane.toWorldCoordinates(new oc.gp_Pnt_3(start.x, start.y, start.z));
const globalTangent = plane.toWorldCoordinates(tangent.wrapped);
const globalEnd = plane.toWorldCoordinates(new oc.gp_Pnt_3(end.x, end.y, end.z));
const arc = new oc.GC_MakeArcOfCircle_5(globalStart, globalTangent, globalEnd).Value();
const handle = new oc.Handle_Geom_Curve_2(arc.get());
return new Edge(new oc.BRepBuilderAPI_MakeEdge_24(handle).Edge());
};
export {TangentArc};