| 19 | using namespace LNLib; |
| 20 | |
| 21 | void cstrNurbsCurve(py::module_&m) |
| 22 | { |
| 23 | py::class_<LNLib::NurbsCurve>(m, "NurbsCurve") |
| 24 | .def_static("Check", &LNLib::NurbsCurve::Check) |
| 25 | .def_static("GetPointOnCurve", &LNLib::NurbsCurve::GetPointOnCurve) |
| 26 | .def_static("ComputeRationalCurveDerivatives", &LNLib::NurbsCurve::ComputeRationalCurveDerivatives) |
| 27 | .def_static("CanComputeDerivative", &LNLib::NurbsCurve::CanComputeDerivative) |
| 28 | .def_static("Curvature", &LNLib::NurbsCurve::Curvature) |
| 29 | .def_static("Torsion", &LNLib::NurbsCurve::Torsion) |
| 30 | .def_static("InsertKnot", [](const LNLib::LN_NurbsCurve& curve, double insertKnot, int times) { |
| 31 | LNLib::LN_NurbsCurve result; |
| 32 | int ret = LNLib::NurbsCurve::InsertKnot(curve, insertKnot, times, result); |
| 33 | return py::make_tuple(ret, result); |
| 34 | }) |
| 35 | .def_static("GetPointOnCurveByCornerCut", &LNLib::NurbsCurve::GetPointOnCurveByCornerCut) |
| 36 | .def_static("RefineKnotVector", [](const LNLib::LN_NurbsCurve& curve, const std::vector<double>& insertKnotElements) { |
| 37 | LNLib::LN_NurbsCurve result; |
| 38 | LNLib::NurbsCurve::RefineKnotVector(curve, insertKnotElements, result); |
| 39 | return result; |
| 40 | }) |
| 41 | .def_static("DecomposeToBeziers", &LNLib::NurbsCurve::DecomposeToBeziers) |
| 42 | .def_static("RemoveKnot", [](const LNLib::LN_NurbsCurve& curve, double removeKnot, int times) { |
| 43 | LNLib::LN_NurbsCurve result; |
| 44 | bool ret = LNLib::NurbsCurve::RemoveKnot(curve, removeKnot, times, result); |
| 45 | return py::make_tuple(ret, result); |
| 46 | }) |
| 47 | .def_static("RemoveExcessiveKnots", [](const LNLib::LN_NurbsCurve& curve) { |
| 48 | LNLib::LN_NurbsCurve result; |
| 49 | LNLib::NurbsCurve::RemoveExcessiveKnots(curve, result); |
| 50 | return result; |
| 51 | }) |
| 52 | .def_static("ElevateDegree", [](const LNLib::LN_NurbsCurve& curve, int times) { |
| 53 | LNLib::LN_NurbsCurve result; |
| 54 | LNLib::NurbsCurve::ElevateDegree(curve, times, result); |
| 55 | return result; |
| 56 | }) |
| 57 | .def_static("ReduceDegree", [](const LNLib::LN_NurbsCurve& curve) { |
| 58 | LNLib::LN_NurbsCurve result; |
| 59 | bool ret = LNLib::NurbsCurve::ReduceDegree(curve, result); |
| 60 | return py::make_tuple(ret, result); |
| 61 | }) |
| 62 | .def_static("EquallyTessellate", [](const LNLib::LN_NurbsCurve& curve) { |
| 63 | std::vector<LNLib::XYZ> tessellatedPoints; |
| 64 | std::vector<double> correspondingKnots; |
| 65 | LNLib::NurbsCurve::EquallyTessellate(curve, tessellatedPoints, correspondingKnots); |
| 66 | return py::make_tuple(tessellatedPoints, correspondingKnots); |
| 67 | }) |
| 68 | .def_static("IsClosed", &LNLib::NurbsCurve::IsClosed) |
| 69 | .def_static("GetParamOnCurve", py::overload_cast<const LNLib::LN_NurbsCurve&, const LNLib::XYZ&>(&LNLib::NurbsCurve::GetParamOnCurve)) |
| 70 | .def_static("CreateTransformed", [](const LNLib::LN_NurbsCurve& curve, const LNLib::Matrix4d& matrix) { |
| 71 | LNLib::LN_NurbsCurve result; |
| 72 | LNLib::NurbsCurve::CreateTransformed(curve, matrix, result); |
| 73 | return result; |
| 74 | }) |
| 75 | .def_static("Reparametrize", [](const LNLib::LN_NurbsCurve& curve, double min, double max) { |
| 76 | LNLib::LN_NurbsCurve result; |
| 77 | LNLib::NurbsCurve::Reparametrize(curve, min, max, result); |
| 78 | return result; |