Mercurial > repos > public > sbplib_julia
comparison src/Grids/manifolds.jl @ 1869:20bd8887db0d feature/grids/manifolds
Fix Aqua and JET fails
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 24 Jan 2025 23:40:28 +0100 |
| parents | de4b4f2aee4f |
| children | 04c251bccbd4 |
comparison
equal
deleted
inserted
replaced
| 1868:81559cb7b11c | 1869:20bd8887db0d |
|---|---|
| 58 unithyperbox(D) = unithyperbox(Float64,D) | 58 unithyperbox(D) = unithyperbox(Float64,D) |
| 59 | 59 |
| 60 | 60 |
| 61 struct Simplex{T,D,NV} <: ParameterSpace{D} | 61 struct Simplex{T,D,NV} <: ParameterSpace{D} |
| 62 verticies::NTuple{NV,SVector{D,T}} | 62 verticies::NTuple{NV,SVector{D,T}} |
| 63 | |
| 64 Simplex(verticies::Tuple{SVector{D,T}, Vararg{SVector{D,T},N}}) where {T,D,N} = new{T,D,N+1}(verticies) | |
| 65 Simplex(::Tuple{}) = throw(ArgumentError("Must provide at least one vertex.")) | |
| 63 end | 66 end |
| 64 | 67 |
| 65 function Simplex(verticies::Vararg{AbstractArray}) | 68 function Simplex(verticies::Vararg{AbstractArray}) |
| 66 ET = mapreduce(eltype,promote_type,verticies) | 69 ET = mapreduce(eltype,promote_type,verticies) |
| 67 T = SVector{length(verticies[1]),ET} | 70 T = SVector{length(verticies[1]),ET} |
| 189 end | 192 end |
| 190 | 193 |
| 191 | 194 |
| 192 function polygon_edges(ps...) | 195 function polygon_edges(ps...) |
| 193 n = length(ps) | 196 n = length(ps) |
| 194 return [LineSegment(ps[i], ps[mod1(i+1,n)]) for i ∈ eachindex(Ps)] | 197 return [LineSegment(ps[i], ps[mod1(i+1,n)]) for i ∈ eachindex(ps)] |
| 195 end | 198 end |
| 196 | 199 |
| 197 struct Circle{T,PT} <: Curve | 200 struct Circle{T,PT} <: Curve |
| 198 c::PT | 201 c::PT |
| 199 r::T | 202 r::T |
| 200 end | 203 end |
| 201 | 204 |
| 202 (c::Circle)(θ) = c.c + r*@SVector[cos(Θ), sin(Θ)] | 205 function (C::Circle)(θ) |
| 206 (;c, r) = C | |
| 207 c + r*@SVector[cos(θ), sin(θ)] | |
| 208 end | |
| 203 | 209 |
| 204 struct TransfiniteInterpolationSurface{T1,T2,T3,T4} <: Surface | 210 struct TransfiniteInterpolationSurface{T1,T2,T3,T4} <: Surface |
| 205 c₁::T1 | 211 c₁::T1 |
| 206 c₂::T2 | 212 c₂::T2 |
| 207 c₃::T3 | 213 c₃::T3 |
