// Created on: 1993-11-25
// Created by: Bruno DUMORTIER
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

#include "BSplCLib.hxx"
#include "gp_Pnt.hxx"
#include "NCollection_Array2.hxx"

//=================================================================================================

inline void BSplSLib::CoefsD0(const double                      U,
                              const double                      V,
                              const NCollection_Array2<gp_Pnt>& Poles,
                              const NCollection_Array2<double>* Weights,
                              gp_Pnt&                           Point)
{
  BSplSLib::CacheD0(U,
                    V,
                    Poles.RowLength() - 1,
                    Poles.ColLength() - 1,
                    0.,
                    0.,
                    1.,
                    1.,
                    Poles,
                    Weights,
                    Point);
}

//=================================================================================================

inline void BSplSLib::CoefsD1(const double                      U,
                              const double                      V,
                              const NCollection_Array2<gp_Pnt>& Poles,
                              const NCollection_Array2<double>* Weights,
                              gp_Pnt&                           Point,
                              gp_Vec&                           VecU,
                              gp_Vec&                           VecV)
{
  BSplSLib::CacheD1(U,
                    V,
                    Poles.RowLength() - 1,
                    Poles.ColLength() - 1,
                    0.,
                    0.,
                    1.,
                    1.,
                    Poles,
                    Weights,
                    Point,
                    VecU,
                    VecV);
}

//=================================================================================================

inline void BSplSLib::CoefsD2(const double                      U,
                              const double                      V,
                              const NCollection_Array2<gp_Pnt>& Poles,
                              const NCollection_Array2<double>* Weights,
                              gp_Pnt&                           Point,
                              gp_Vec&                           VecU,
                              gp_Vec&                           VecV,
                              gp_Vec&                           VecUU,
                              gp_Vec&                           VecUV,
                              gp_Vec&                           VecVV)
{
  BSplSLib::CacheD2(U,
                    V,
                    Poles.RowLength() - 1,
                    Poles.ColLength() - 1,
                    0.,
                    0.,
                    1.,
                    1.,
                    Poles,
                    Weights,
                    Point,
                    VecU,
                    VecV,
                    VecUU,
                    VecUV,
                    VecVV);
}

//=================================================================================================

inline void BSplSLib::PolesCoefficients(const NCollection_Array2<gp_Pnt>& Poles,
                                        NCollection_Array2<gp_Pnt>&       CachePoles)
{
  BSplSLib::PolesCoefficients(Poles, BSplSLib::NoWeights(), CachePoles, BSplSLib::NoWeights());
}

//=================================================================================================

inline NCollection_Array2<double>* BSplSLib::NoWeights()
{
  return nullptr;
}
