From b4aa3dff231341dddc67ef74e246ea32744d7756 Mon Sep 17 00:00:00 2001 From: Daniel Baston Date: Thu, 15 Aug 2024 09:45:35 -0400 Subject: [PATCH] CircularArc: Add comment from @rouault on optimizations --- include/geos/geom/CircularArc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/geos/geom/CircularArc.h b/include/geos/geom/CircularArc.h index 699ebd5f1b..283eaf3b08 100644 --- a/include/geos/geom/CircularArc.h +++ b/include/geos/geom/CircularArc.h @@ -92,6 +92,11 @@ class GEOS_DLL CircularArc { return 2*MATH_PI; } + /// Even Rouault: + /// potential optimization?: using crossproduct(p0 - center, p2 - center) = radius * radius * sin(angle) + /// could yield the result by just doing a single asin(), instead of 2 atan2() + /// actually one should also likely compute dotproduct(p0 - center, p2 - center) = radius * radius * cos(angle), + /// and thus angle = atan2(crossproduct(p0 - center, p2 - center) , dotproduct(p0 - center, p2 - center) ) auto t0 = theta0(); auto t2 = theta2();