Mercurial > repos > public > sbplib_julia
comparison src/Grids/manifolds.jl @ 1625:84c3b9d71218 feature/grids/manifolds
Add linesegments function
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 14 Jun 2024 13:09:00 +0200 |
| parents | f77c5309dd2b |
| children | e213bd857f3f |
comparison
equal
deleted
inserted
replaced
| 1586:d4a6f9effcdd | 1625:84c3b9d71218 |
|---|---|
| 158 end | 158 end |
| 159 | 159 |
| 160 (c::LineSegment)(s) = (1-s)*c.a + s*c.b | 160 (c::LineSegment)(s) = (1-s)*c.a + s*c.b |
| 161 | 161 |
| 162 | 162 |
| 163 function linesegments(ps...) | |
| 164 return [LineSegment(ps[i], ps[i+1]) for i ∈ 1:length(ps)-1] | |
| 165 end | |
| 166 | |
| 167 | |
| 168 function polygon_edges(ps...) | |
| 169 n = length(ps) | |
| 170 return [LineSegment(ps[i], ps[mod1(i+1,n)]) for i ∈ eachindex(Ps)] | |
| 171 end | |
| 172 | |
| 163 struct Circle{T,PT} <: Curve | 173 struct Circle{T,PT} <: Curve |
| 164 c::PT | 174 c::PT |
| 165 r::T | 175 r::T |
| 166 end | 176 end |
| 167 | 177 |
| 188 function (s::TransfiniteInterpolationSurface)(ξ̄::AbstractArray) | 198 function (s::TransfiniteInterpolationSurface)(ξ̄::AbstractArray) |
| 189 s(ξ̄...) | 199 s(ξ̄...) |
| 190 end | 200 end |
| 191 | 201 |
| 192 | 202 |
| 193 function polygon_sides(Ps...) | |
| 194 n = length(Ps) | |
| 195 return [t->line(t,Ps[i],Ps[mod1(i+1,n)]) for i ∈ eachindex(Ps)] | |
| 196 end |
