1. Ktirio library contribution

One of the objectives of the project is to adapt CGAL method to be used with our structure of Mesh in ktirio application. Vincent Chabannes gives us a base with a data structure for Mesh,Mesh Point, Point, Polygon and conversion between Cgal Surface_mesh and Mesh from ktirio with that i had to create method that apply CGAL method on ktirio mesh.

1.1. Syntaxe

To use CGAL function you need to initiated a CGAL kernel [1], two of them are preferred :

  • CGAL::Exact_predicates_exact_constructions_kernel

  • CGAL::Exact_predicates_inexact_constructions_kernel

both of them provide :

  • Uses Cartesian representation.

  • Supports constructions of points from double Cartesian coordinates.

  • For the exact : It provides both exact geometric predicates and exact geometric constructions.

  • For the inexact : It provides exact geometric predicates, but inexact geometric constructions.

We will refered to the Kernel as a template in all function that need it. Cgal may need some definition like this for exemple with the type of Point.In the packages Point_set_processing you can define either Kernel::Point_2 Point_type_name or Kernel::Point_3 Point_type_name, all definition like this would be placed in the template definition of the function.

1.2. Class implemented

As Kinetic need point cloud as an input we need a structure equivalent to the Point_3 from CGAL.

So We implemented a Class : PointSet.Capable for now to read a Mesh from ktirio and stock all of his point and the normal associated.The inititation is show in the block below with his conversion to CGAL :

Class PointSet{

    public:
    PointSet(Mesh const& ktirio_mesh){...}
    PointSet(){...}

    private:
    std::unordered_map<int, pointType> M_point_set;
    std::unordered_map<int, pointType> M_normal_set;
    std::unordered_map<int, std::vector<marker_id_type>> M_labet_set;
    }

template <typename KernelType,typename PointType>
void toPointSetCgal(PointSet const &ps_ktirio,CGAL::Point_set_3<PointType> &ps,bool hasnormal = false )

template <typename KernelType, typename PointType>
void toPointSetKtirio(PointSet const &ps_ktirio, const CGAL::Point_set_3<PointType>& ps_Cgal,bool has_normal = false)

Documentation for Point set class.

1.3. Function for mesh,point set manipulation and verification.

enum class propertyToCheck
{
    isClosed,
    isOutwardOriented,
    isTriangle,
    isSelfIntersect,
    isConnected
};

template<typename Meshtype,typename KernelType>
bool checkProperties(Meshtype &ktirio_mesh,const std::vector<propertyToCheck>& properties)

template<typename Meshtype,typename KernelType>
void remesh(Mesh &ktirio_mesh,double target_edge_length = 0.04)

template<typename Meshtype,typename Kernel>
bool orient(Mesh &ktirio_mesh)

template<typename Meshtype , typename KernelType>
int gridSimplify(Meshtype &ktiriomesh,PointSet &ktiriops)

template<typename Meshtype>
void getPointSetByMarker(Meshtype &mesh, PointSet &ps, std::string markername)

template<typename Meshtype>
void compareMesh(Meshtype &input_mesh,Meshtype &output_Mesh)

template<typename Kernel,typename FT> int
KSR(po::variables_map &vm,PointSet &ktirio_ps,std::vector<std::vector<std::size_t>>& polylist)

template<typename Meshtype, typename KernelType>
void refineSelfIntersect(Meshtype &ktirio_mesh)

template<typename MeshType, typename Kerneltype>
void putName(Meshtype &ksr_input,Meshtype &ksr_output)

Documentation for Check validity function

Documentation for Mesh manipulation function

1.4. IO Function

void writePly(PointSet &pointset,std::string &filename,bool hasnormal = false)

void writeOff(std::string const &filename, PointSet &ps, std::vector<std::vector<std::size_t>> &polylist)

void writeObj(const std::string& filename, const Feel::Ktirio::Geom::PointSet& ps, const std::vector<std::vector<std::size_t>>& polylist)

Documentation for IO function