-
-
-
-
-
-// ===================== Auxiliary functions ===================================
-template<class SurfOrAdapt>
-void derivatives(Standard_Integer theMaxOrder,
- Standard_Integer theMinOrder,
- const Standard_Real theU,
- const Standard_Real theV,
- const SurfOrAdapt& theBasisSurf,
- const Standard_Integer theNU,
- const Standard_Integer theNV,
- const Standard_Boolean theAlongU,
- const Standard_Boolean theAlongV,
- const Handle(Geom_BSplineSurface)& theL,
- TColgp_Array2OfVec& theDerNUV,
- TColgp_Array2OfVec& theDerSurf)
-{
- Standard_Integer i, j;
- gp_Pnt P;
- gp_Vec DL1U, DL1V, DL2U, DL2V, DL2UV, DL3U, DL3UUV, DL3UVV, DL3V;
-
- if (theAlongU || theAlongV)
- {
- theMaxOrder = 0;
- TColgp_Array2OfVec DerSurfL(0, theMaxOrder + theNU + 1, 0, theMaxOrder + theNV + 1);
- switch (theMinOrder)
- {
- case 1:
- theL->D1(theU, theV, P, DL1U, DL1V);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- break;
- case 2:
- theL->D2(theU, theV, P, DL1U, DL1V, DL2U, DL2V, DL2UV);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- DerSurfL.SetValue(1, 1, DL2UV);
- DerSurfL.SetValue(2, 0, DL2U);
- DerSurfL.SetValue(0, 2, DL2V);
- break;
- case 3:
- theL->D3(theU, theV, P, DL1U, DL1V, DL2U, DL2V, DL2UV, DL3U, DL3V, DL3UUV, DL3UVV);
- DerSurfL.SetValue(1, 0, DL1U);
- DerSurfL.SetValue(0, 1, DL1V);
- DerSurfL.SetValue(1, 1, DL2UV);
- DerSurfL.SetValue(2, 0, DL2U);
- DerSurfL.SetValue(0, 2, DL2V);
- DerSurfL.SetValue(3, 0, DL3U);
- DerSurfL.SetValue(2, 1, DL3UUV);
- DerSurfL.SetValue(1, 2, DL3UVV);
- DerSurfL.SetValue(0, 3, DL3V);
- break;
- default:
- break;
- }
-
- if (theNU <= theNV)
- {
- for (i = 0; i <= theMaxOrder + 1 + theNU; i++)
- for (j = i; j <= theMaxOrder + theNV + 1; j++)
- if (i + j > theMinOrder)
- {
- DerSurfL.SetValue(i, j, theL->DN(theU, theV, i, j));
- theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
- if (i != j && j <= theNU + 1)
- {
- theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
- DerSurfL.SetValue(j, i, theL->DN(theU, theV, j, i));
- }
- }
- }
- else
- {
- for (j = 0; j <= theMaxOrder + 1 + theNV; j++)
- for (i = j; i <= theMaxOrder + theNU + 1; i++)
- if (i + j > theMinOrder)
- {
- DerSurfL.SetValue(i, j, theL->DN(theU, theV, i, j));
- theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
- if (i != j && i <= theNV + 1)
- {
- theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
- DerSurfL.SetValue(j, i, theL->DN(theU, theV, j, i));
- }
- }
- }
- for (i = 0; i <= theMaxOrder + theNU; i++)
- for (j = 0; j <= theMaxOrder + theNV; j++)
- {
- if (theAlongU)
- theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, DerSurfL, theDerSurf));
- if (theAlongV)
- theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, theDerSurf, DerSurfL));
- }
- }
- else
- {
- for (i = 0; i <= theMaxOrder + theNU+ 1; i++)
- for (j = i; j <= theMaxOrder + theNV + 1; j++)
- if (i + j > theMinOrder)
- {
- theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j));
- if (i != j)
- theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i));
- }
- for (i = 0; i <= theMaxOrder + theNU; i++)
- for (j = 0; j <= theMaxOrder + theNV; j++)
- theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, theDerSurf));
- }
-}
-