// Reconstruction - A tool for building cad models from meshes
// Copyright (C) 2010-2026 Eric Bechet, Borhen Louhichi
//
// See the LICENSE file for license information and contributions.
// Please report all bugs and problems to <bechet@cadxfem.org>.

#ifndef BSPLINEINTERPOLSURFACE_H
#define BSPLINEINTERPOLSURFACE_H

#include "GeomPlate_Surface.hxx"
#include "AdvApp2Var_Criterion.hxx"
#include "TColStd_HArray1OfReal.hxx"
#include "TColStd_HArray2OfReal.hxx"
#include "GeomAbs_IsoType.hxx"
#include "AdvApprox_DichoCutting.hxx"
#include "AdvApp2Var_EvaluatorFunc2Var.hxx"
#include "gp_Pnt.hxx"
#include "gp_Vec.hxx"

#include "TColgp_SequenceOfXY.hxx"
#include "TColgp_SequenceOfXYZ.hxx"
#include "GeomPlate_PlateG0Criterion.hxx"
#include "GeomPlate_PlateG1Criterion.hxx"

//#include "AdvApp2Var_ApproxAFunc2Var.hxx"
#include "ApproxAFunc2Var.h"

class GeomPlate_Surface;
class Geom_BSplineSurface;
class AdvApp2Var_Criterion;


class BSplineApproxSurface
{
public:

  void* operator new(size_t,void* anAddress)
  {
    return anAddress;
  }
  void* operator new(size_t size)
  {
    return Standard::Allocate(size);
  }
  void  operator delete(void *anAddress)
  {
    if (anAddress) Standard::Free((Standard_Address&) anAddress);
  }
  // Construction and destruction.  The preconditions for calling the
  // constructor are
  //   1 <= degree0 && degree0 < numControls0 <= numSamples0
  //   1 <= degree1 && degree1 < numControls1 <= numSamples1
  /*    BSplineApproxSurface (const Handle(GeomPlate_Surface)& SurfPlate,
          const AdvApp2Var_Criterion& PlateCrit,
                                             const Standard_Real Tol3d,
          const Standard_Integer Nbmax,
          const Standard_Integer dgmax,
          const GeomAbs_Shape Continuity,
          const Standard_Real EnlargeCoeff);
  */
  Standard_EXPORT BSplineApproxSurface(const Handle(GeomPlate_Surface) & SurfPlate,
                                       const Standard_Real Tol3d,
                                       const Standard_Integer Nbmax,
                                       const Standard_Integer dgmax,
                                       const Standard_Real dmax,
                                       const Standard_Integer CritOrder=0,
                                       const GeomAbs_Shape Continuity=GeomAbs_C1,
                                       const Standard_Real EnlargeCoeff=1.1);

  //~BSplineApproxSurface ();

  Standard_EXPORT Handle(Geom_BSplineSurface) Surface() const;
  Standard_EXPORT Standard_Real ApproxError() const;
  Standard_EXPORT Standard_Real CriterionError() const;



private:

  Handle_GeomPlate_Surface myPlate;
  Handle_Geom_BSplineSurface mySurface;
  Standard_Real myAppError;
  Standard_Real myCritError;




};

static Handle(Geom_Surface) fonct = NULL;

#endif
