Part: [skip ci] check for mults of inner knots when creating B-Spline curve/surface

This commit is contained in:
wmayer
2020-02-17 15:38:01 +01:00
parent 9cefd8858c
commit 48744aa9b5
2 changed files with 21 additions and 1 deletions

View File

@@ -1241,7 +1241,15 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
occmults.SetValue(occmults.Length(), degree+1);
sum_of_mults = occmults.Length()+2*degree;
}
else { sum_of_mults = occmults.Length()-1;}
else {
sum_of_mults = occmults.Length()-1;
}
}
// check multiplicity of inner knots
for (Standard_Integer i=2; i < occmults.Length(); i++) {
if (occmults(i) > degree) {
Standard_Failure::Raise("multiplicity of inner knot higher than degree");
}
}
if (knots != Py_None) { //knots are given
Py::Sequence knotssq(knots);

View File

@@ -1514,6 +1514,18 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
(PyObject_Not(vperiodic) && sum_of_vmults - vdegree -1 != lv)) {
Standard_Failure::Raise("number of poles and sum of mults mismatch");
}
// check multiplicity of inner knots
for (Standard_Integer i=2; i < occumults.Length(); i++) {
if (occumults(i) > udegree) {
Standard_Failure::Raise("multiplicity of inner knot higher than degree");
}
}
for (Standard_Integer i=2; i < occvmults.Length(); i++) {
if (occvmults(i) > vdegree) {
Standard_Failure::Raise("multiplicity of inner knot higher than degree");
}
}
Handle(Geom_BSplineSurface) spline = new Geom_BSplineSurface(occpoles,occweights,
occuknots,occvknots,occumults,occvmults,udegree,vdegree,
PyObject_IsTrue(uperiodic) ? Standard_True : Standard_False,