Skip to content

Instantly share code, notes, and snippets.

View afabri's full-sized avatar

Andreas Fabri afabri

View GitHub Profile
@afabri
afabri / polys.cpp
Created December 8, 2022 16:25
Joining several polygons
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/IO/WKT.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
@afabri
afabri / kruskal.cpp
Created November 9, 2022 16:40
boost::kruskal_minimum_spanning_tree for a Polyhedron without points
#include <CGAL/Polyhedron_3.h>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/boost/graph/kruskal_min_spanning_tree.h>
#include <CGAL/Simple_cartesian.h>
struct empty {};
struct traits {
using Point_3 = empty;
using Plane_3 = empty;
@afabri
afabri / TinyAD4CGAL.cpp
Created August 23, 2022 15:20
Towards adding an example to TinyAD that uses CGAL::Surface_mesh
#include <Eigen/Core>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Surface_mesh_parameterization/IO/File_off.h>
#include <CGAL/Surface_mesh_parameterization/parameterize.h>
#include <CGAL/Surface_mesh_parameterization/Barycentric_mapping_parameterizer_3.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
namespace TinyAD {
@afabri
afabri / bykat.cpp
Created June 29, 2022 09:52
Issue 6723
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/ch_bykat.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
int main()
{
std::vector<Point_2> v;
std::vector<Point_2> w({
@afabri
afabri / join.cpp
Created June 7, 2022 13:17
Join two polygons
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
#include <CGAL/Polygon_2.h>
#include <CGAL/IO/WKT.h>
#include <iostream>
#include <fstream>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Point_2 Point;
@afabri
afabri / RatiionalReadingBug.cpp
Created June 2, 2022 14:20
Problem with comma as separator when reading a boost multiprecision rational number
#include <iostream>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
# include <boost/multiprecision/gmp.hpp>
int main(){
//boost::multiprecision::cpp_rational q;
boost::multiprecision::mpq_rational q;
std::istringstream is("5,600");
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <CGAL/Polygon_mesh_processing/repair.h>
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polygon_mesh_processing/locate.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/IO/write_VTU.h>
#include <iostream>
@afabri
afabri / Kernel_traits_N.cpp
Created March 11, 2022 06:47
Find a kernel that is not the Dummy_kernel
#include <type_traits>
#include <typeinfo>
#include <iostream>
template <typename T>
struct Dummy
{};