Skip to content

Instantly share code, notes, and snippets.

View afabri's full-sized avatar

Andreas Fabri afabri

View GitHub Profile
@afabri
afabri / issue7235.cpp
Created February 1, 2023 15:58
Issue 7325
// Created by Dominik Krupke on 14.11.22.
//
#include <vector>
#include <iterator>
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
@afabri
afabri / sm_ply.cpp
Created January 11, 2023 18:00
Writing and reading PLY files
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/IO/PLY.h>
#include <CGAL/Surface_mesh/IO/PLY.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/IO/Color.h>
#include <iostream>
#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/Timer.h>
#include <cassert>
#include <iostream>
@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>