diff src/Grids/geometry.jl @ 2011:d0b6c63c506e feature/grids/geometry_functions

Add Arc type for representing partial circles
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 07 May 2025 08:38:35 +0200
parents 730c9848ad0b
children 4617e4b74b82
line wrap: on
line diff
--- a/src/Grids/geometry.jl	Thu May 01 17:25:24 2025 +0200
+++ b/src/Grids/geometry.jl	Wed May 07 08:38:35 2025 +0200
@@ -155,6 +155,32 @@
     r*@SVector[-sin(θ), cos(θ)]
 end
 
+struct Arc{PT,T}
+    c::Circle{PT,T}
+    θ₀::T
+    θ₁::T
+end
+
+"""
+    Arc(C::Circle, θ₀, θ₁)
+
+# TODO
+"""
+function Arc(C, θ₀, θ₁)
+    r, θ₀, θ₁ = promote(C.r, θ₀, θ₁)
+
+    return Arc(Circle(C.c, r), θ₀, θ₁)
+end
+
+function (A::Arc)(t)
+    (; θ₀, θ₁) = A
+    return A.c((1-t)*θ₀ + t*θ₁)
+end
+
+function Grids.jacobian(a::Arc, t)
+    return nothing
+end
+
 """
     TransfiniteInterpolationSurface(c₁, c₂, c₃, c₄)