Skip to content

Instantly share code, notes, and snippets.

@afabri
Created October 21, 2021 06:46
Show Gist options
  • Save afabri/1fc3f58b588e5318ffd279abb13b26f8 to your computer and use it in GitHub Desktop.
Save afabri/1fc3f58b588e5318ffd279abb13b26f8 to your computer and use it in GitHub Desktop.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/optimal_bounding_box.h>
#include <fstream>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point;
int main(int argc, char** argv)
{
const char* filename = (argc > 1) ? argv[1] : "data/pig.off";
std::ifstream in(filename);
std::vector<Point> points;
Point p;
while(in >> p){
points.push_back(p);
}
// Compute the extreme points of the mesh, and then a tightly fitted oriented bounding box
std::array<Point, 8> obb_points;
CGAL::oriented_bounding_box(points, obb_points,
CGAL::parameters::use_convex_hull(true));
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment