// Author : Luc Jaulin
//---------------------------------------------------------------------------
#ifndef pavingH
#define pavingH
#include <vector>
#include "iboolean.h"
#include "box.h"
#include <iostream>

    class paving
    {
    public:
    vector <box> B;
    vector <int> left;
    vector <int> right;
    vector <iboolean> val;
    paving() ;
    paving(box& v,iboolean b) ;

    paving& Expand(int);
    paving& Remove_sons(int i);
    paving& Clean();
    paving& Reunite(int i=0);

    paving& Sivia(iboolean(*)(const box&),iboolean(*op)(iboolean,iboolean),double eps);
    paving& Sivia(box(*F)(const box&),paving& X,iboolean(*op)(iboolean,iboolean),double eps);

    paving& Clear(iboolean);
    friend ostream& operator<<(ostream&, const paving&);
    friend void  op_binaire(paving& Z,paving& X,paving& Y, iboolean(*op)(iboolean,iboolean),int k=0, int i=0,int j=0) ;
    friend void  op_unaire(paving& Z,paving& X,iboolean(*op)(iboolean),int k=0,int i=0);

    friend void Contract_distance_gt_paving(paving& Z, double z, box& X, int k=0);

    friend void  Set_Contractor_Inter(paving& X,paving& Y,paving& Z);
    friend void  Set_Contractor_Subset(paving& X,paving& Y);
    friend void  Set_Contractor_Disjoint(paving& X,paving& Y);
    friend void  Set_Contractor_Overlap(paving& X,paving& Y);
    friend iboolean Overlap(paving& X,paving& Y);
    friend  paving  Sqcap(paving& X,paving& Y);
    friend  paving  Complement(paving& X);




    //~paving ();
    //paving& operator=(const paving&);
    };

    //----------------------------------------------------------
#endif
