Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 2010:cf0fa2967361 | 2011:d0b6c63c506e |
|---|---|
| 151 end | 151 end |
| 152 | 152 |
| 153 function Grids.jacobian(C::Circle, θ) | 153 function Grids.jacobian(C::Circle, θ) |
| 154 (;r) = C | 154 (;r) = C |
| 155 r*@SVector[-sin(θ), cos(θ)] | 155 r*@SVector[-sin(θ), cos(θ)] |
| 156 end | |
| 157 | |
| 158 struct Arc{PT,T} | |
| 159 c::Circle{PT,T} | |
| 160 θ₀::T | |
| 161 θ₁::T | |
| 162 end | |
| 163 | |
| 164 """ | |
| 165 Arc(C::Circle, θ₀, θ₁) | |
| 166 | |
| 167 # TODO | |
| 168 """ | |
| 169 function Arc(C, θ₀, θ₁) | |
| 170 r, θ₀, θ₁ = promote(C.r, θ₀, θ₁) | |
| 171 | |
| 172 return Arc(Circle(C.c, r), θ₀, θ₁) | |
| 173 end | |
| 174 | |
| 175 function (A::Arc)(t) | |
| 176 (; θ₀, θ₁) = A | |
| 177 return A.c((1-t)*θ₀ + t*θ₁) | |
| 178 end | |
| 179 | |
| 180 function Grids.jacobian(a::Arc, t) | |
| 181 return nothing | |
| 156 end | 182 end |
| 157 | 183 |
| 158 """ | 184 """ |
| 159 TransfiniteInterpolationSurface(c₁, c₂, c₃, c₄) | 185 TransfiniteInterpolationSurface(c₁, c₂, c₃, c₄) |
| 160 | 186 |
