Part: Use PyObject_IsTrue in combination with conditional ternary operator

This commit is contained in:
marioalexis
2022-05-17 16:31:06 -03:00
committed by Chris Hennes
parent ea79771afd
commit ad0f1147f7
5 changed files with 31 additions and 29 deletions

View File

@@ -1457,10 +1457,10 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
occvknots.SetValue(i,(double)(i-1)/(occvknots.Length()-1));
}
}
if ((PyObject_IsTrue(uperiodic) && sum_of_umults != lu) ||
(PyObject_Not(uperiodic) && sum_of_umults - udegree -1 != lu) ||
(PyObject_IsTrue(vperiodic) && sum_of_vmults != lv) ||
(PyObject_Not(vperiodic) && sum_of_vmults - vdegree -1 != lv)) {
if (((PyObject_IsTrue(uperiodic) ? true : false) && sum_of_umults != lu) ||
((PyObject_Not(uperiodic) ? true : false) && sum_of_umults - udegree -1 != lu) ||
((PyObject_IsTrue(vperiodic) ? true : false) && sum_of_vmults != lv) ||
((PyObject_Not(vperiodic) ? true : false) && sum_of_vmults - vdegree -1 != lv)) {
Standard_Failure::Raise("number of poles and sum of mults mismatch");
}
// check multiplicity of inner knots
@@ -1538,7 +1538,7 @@ PyObject* BSplineSurfacePy::buildFromNSections(PyObject *args)
}
GeomFill_NSections fillOp(curveSeq);
if (PyObject_IsTrue(refSurf)) {
if (PyObject_IsTrue(refSurf) ? true : false) {
Handle(Geom_BSplineSurface) ref = Handle(Geom_BSplineSurface)::DownCast
(getGeometryPtr()->handle());
fillOp.SetSurface(ref);