add methods to convert a curve to a B-Spline or NURBS
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
# include <GC_MakeSegment.hxx>
|
||||
# include <Precision.hxx>
|
||||
# include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
# include <ShapeConstruct_Curve.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/VectorPy.h>
|
||||
@@ -318,6 +318,21 @@ TopoDS_Shape GeomCurve::toShape() const
|
||||
return mkBuilder.Shape();
|
||||
}
|
||||
|
||||
GeomBSplineCurve* GeomCurve::toBSpline(double first, double last) const
|
||||
{
|
||||
ShapeConstruct_Curve scc;
|
||||
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle());
|
||||
Handle_Geom_BSplineCurve spline = scc.ConvertToBSpline(c, first, last, Precision::Confusion());
|
||||
if (spline.IsNull())
|
||||
throw Base::RuntimeError("Conversion to B-Spline failed");
|
||||
return new GeomBSplineCurve(spline);
|
||||
}
|
||||
|
||||
GeomBSplineCurve* GeomCurve::toNurbs(double first, double last) const
|
||||
{
|
||||
return toBSpline(first, last);
|
||||
}
|
||||
|
||||
bool GeomCurve::tangent(double u, gp_Dir& dir) const
|
||||
{
|
||||
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle());
|
||||
|
||||
Reference in New Issue
Block a user