Created
March 9, 2022 10:16
-
-
Save GilesBathgate/6a50e72772fdf7c36f90cb7ad5305fd1 to your computer and use it in GitHub Desktop.
Sphere circle benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> | |
#include <CGAL/Kernel/global_functions.h> | |
#include <CGAL/Nef_S2/Sphere_circle.h> | |
#include <CGAL/point_generators_3.h> | |
#include <benchmark/benchmark.h> | |
using K = CGAL::Exact_predicates_exact_constructions_kernel; | |
using Point = CGAL::Point_3<K>; | |
using Plane = CGAL::Plane_3<K>; | |
using Sphere_circle = CGAL::Sphere_circle<K>; | |
static void BM_Plane(benchmark::State& state) { | |
CGAL::Random_points_on_sphere_3<Point> rnd; | |
for (auto _ : state) { | |
Point p1=*rnd++; | |
Point p2=*rnd++; | |
auto v1 = K().construct_orthogonal_vector_3_object()(p1,p2,Point(CGAL::ORIGIN)); | |
Plane h(CGAL::ORIGIN,v1); | |
Sphere_circle c(h); | |
benchmark::DoNotOptimize(c); | |
} | |
} | |
static void BM_NoPlane(benchmark::State& state) { | |
CGAL::Random_points_on_sphere_3<Point> rnd; | |
for (auto _ : state) { | |
Point p1=*rnd++; | |
Point p2=*rnd++; | |
auto v1 = K().construct_orthogonal_vector_3_object()(p1,p2,Point(CGAL::ORIGIN)); | |
Sphere_circle c(CGAL::ORIGIN,v1); | |
benchmark::DoNotOptimize(c); | |
} | |
} | |
BENCHMARK(BM_Plane); | |
BENCHMARK(BM_NoPlane); | |
BENCHMARK_MAIN(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment