Mercurial > repos > public > sbplib_julia
comparison src/Grids/geometry.jl @ 2071:9e9c56f5a656 feature/grids/geometry_functions
Add parameter validation when calling a transfinite interpolation object
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 17 Feb 2026 20:37:53 +0100 |
| parents | c68fa6c74477 |
| children | c36812de3f2d |
comparison
equal
deleted
inserted
replaced
| 2070:c68fa6c74477 | 2071:9e9c56f5a656 |
|---|---|
| 52 | 52 |
| 53 """ | 53 """ |
| 54 LineSegment(a,b) | 54 LineSegment(a,b) |
| 55 | 55 |
| 56 A line segment, as a callable object, from `a` to `b`. | 56 A line segment, as a callable object, from `a` to `b`. |
| 57 The parametrization is ``l(s) = (1-s)a + s*b`` where ``s\in(0,1)``. | 57 The parametrization is ``l(s) = (1-s)a + s*b`` where ``s∈(0,1)``. |
| 58 | 58 |
| 59 # Example | 59 # Example |
| 60 ```julia-repl | 60 ```julia-repl |
| 61 julia> l = Grids.LineSegment([1,1],[2,1]) | 61 julia> l = Grids.LineSegment([1,1],[2,1]) |
| 62 Diffinitive.Grids.LineSegment{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1]) | 62 Diffinitive.Grids.LineSegment{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1]) |
| 248 c₃::T3 | 248 c₃::T3 |
| 249 c₄::T4 | 249 c₄::T4 |
| 250 end | 250 end |
| 251 | 251 |
| 252 function (s::TransfiniteInterpolationSurface)(u,v) | 252 function (s::TransfiniteInterpolationSurface)(u,v) |
| 253 if (u,v) ∉ unitsquare() | |
| 254 throw(DomainError((u,v), "Transfinite interpolation was called with parameters outside the unit square.")) | |
| 255 end | |
| 253 c₁, c₂, c₃, c₄ = s.c₁, s.c₂, s.c₃, s.c₄ | 256 c₁, c₂, c₃, c₄ = s.c₁, s.c₂, s.c₃, s.c₄ |
| 254 P₀₀ = c₁(0) | 257 P₀₀ = c₁(0) |
| 255 P₁₀ = c₂(0) | 258 P₁₀ = c₂(0) |
| 256 P₁₁ = c₃(0) | 259 P₁₁ = c₃(0) |
| 257 P₀₁ = c₄(0) | 260 P₀₁ = c₄(0) |
