From f732ea1ab553b92e04557e9a2252a8b36eb1af9f Mon Sep 17 00:00:00 2001 From: ifv Date: Thu, 20 Feb 2020 14:42:47 +0300 Subject: [PATCH] 0031381: Foundation Classes -wrong evaluations for rational BSpline curves using Adaptor curves BSplCLib_Cache.cxx - it is forbidden zeroing derivatives for rational splines when derivative order more than degree bug31381 - test case added --- src/BSplCLib/BSplCLib_Cache.cxx | 2 +- tests/bugs/fclasses/bug31381 | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/fclasses/bug31381 diff --git a/src/BSplCLib/BSplCLib_Cache.cxx b/src/BSplCLib/BSplCLib_Cache.cxx index f835c9b9e3..2075211c4e 100644 --- a/src/BSplCLib/BSplCLib_Cache.cxx +++ b/src/BSplCLib/BSplCLib_Cache.cxx @@ -111,7 +111,7 @@ void BSplCLib_Cache::CalculateDerivative(const Standard_Real& theParameter, // When the degree of curve is lesser than the requested derivative, // nullify array cells corresponding to greater derivatives Standard_Integer aDerivative = theDerivative; - if (myParams.Degree < theDerivative) + if (!myIsRational && myParams.Degree < theDerivative) { aDerivative = myParams.Degree; for (Standard_Integer ind = myParams.Degree * aDimension; ind < (theDerivative + 1) * aDimension; ind++) diff --git a/tests/bugs/fclasses/bug31381 b/tests/bugs/fclasses/bug31381 new file mode 100644 index 0000000000..fbc313f208 --- /dev/null +++ b/tests/bugs/fclasses/bug31381 @@ -0,0 +1,15 @@ +puts "# ============" +puts "# 0031381: Foundation Classes - wrong evaluations for rational BSpline curves using Adaptor curves " +puts "# ============" +puts "" +puts "Eliminate output of approxcurve command" +puts "REQUIRED ALL: Error 4.32754e-05" + +circle c 0 0 1 +puts "Get rational BSpline curve of degree 2" +convert c c +puts "Get offset curve to force calculation of D3 for base curve when algorithm needs D2 for offset" +offset oc c -.5 +puts "Approximate offset curve with continuity C2" +approxcurve ac oc 1.e-4 2 5 25 +checklength ac -l 3.1415850499856011 \ No newline at end of file