comparison src/Grids/geometry.jl @ 2070:c68fa6c74477 feature/grids/geometry_functions

Explain parametrizations in docstrings
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 17 Feb 2026 20:25:13 +0100
parents 15f27fea9929
children 9e9c56f5a656
comparison
equal deleted inserted replaced
2069:15f27fea9929 2070:c68fa6c74477
4 4
5 Line{PT}(p::PT, tangent::PT) where PT = new{PT}(p,tangent) 5 Line{PT}(p::PT, tangent::PT) where PT = new{PT}(p,tangent)
6 end 6 end
7 7
8 8
9 # REVIEW:
10 # 1. Explain the parametrization, i.e., l(1) = p + s*t
11 """ 9 """
12 Line(p,t) 10 Line(p,t)
13 11
14 A line, as a callable object, starting at `p` with tangent `t`. 12 A line, as a callable object, starting at `p` with tangent `t`.
13 The parametrization is ``l(s) = p + st``.
15 14
16 # Example 15 # Example
17 ```julia-repl 16 ```julia-repl
18 julia> l = Grids.Line([1,1],[2,1]) 17 julia> l = Grids.Line([1,1],[2,1])
19 Diffinitive.Grids.Line{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1]) 18 Diffinitive.Grids.Line{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1])
49 48
50 LineSegment{PT}(p::PT, tangent::PT) where PT = new{PT}(p,tangent) 49 LineSegment{PT}(p::PT, tangent::PT) where PT = new{PT}(p,tangent)
51 end 50 end
52 51
53 52
54 # REVIEW:
55 # 1. Explain the parametrization.
56 # 3. Do we want s in [0, 1]? Currently the line segment
57 # can return values "outside" of the interval [a,b].
58 """ 53 """
59 LineSegment(a,b) 54 LineSegment(a,b)
60 55
61 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)``.
62 58
63 # Example 59 # Example
64 ```julia-repl 60 ```julia-repl
65 julia> l = Grids.LineSegment([1,1],[2,1]) 61 julia> l = Grids.LineSegment([1,1],[2,1])
66 Diffinitive.Grids.LineSegment{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1]) 62 Diffinitive.Grids.LineSegment{StaticArraysCore.SVector{2, Int64}}([1, 1], [2, 1])
234 230
235 return Arc(Circle(c,abs(r)), θₐ, θₐ+Δθ) 231 return Arc(Circle(c,abs(r)), θₐ, θₐ+Δθ)
236 end 232 end
237 233
238 # REVIEW: 234 # REVIEW:
239 # 1. Explain parametrisation
240 # 2. Boundscheck for the parametrisation argumetns, i.e. within [0,1]? 235 # 2. Boundscheck for the parametrisation argumetns, i.e. within [0,1]?
241 """ 236 """
242 TransfiniteInterpolationSurface(c₁, c₂, c₃, c₄) 237 TransfiniteInterpolationSurface(c₁, c₂, c₃, c₄)
243 238
244 A surface defined by the transfinite interpolation of the curves `c₁`, `c₂`, `c₃`, and `c₄`. 239 A surface defined by the transfinite interpolation of the curves `c₁`, `c₂`, `c₃`, and `c₄`.
240 The transfinite interpolation maps the unit square ([0,1]⊗[0,1]) to the patch delimited by the given curves.
241 The curves should encircle the patch counterclockwise.
242
243 See https://en.wikipedia.org/wiki/Transfinite_interpolation for more information on transfinite interpolation.
245 """ 244 """
246 struct TransfiniteInterpolationSurface{T1,T2,T3,T4} 245 struct TransfiniteInterpolationSurface{T1,T2,T3,T4}
247 c₁::T1 246 c₁::T1
248 c₂::T2 247 c₂::T2
249 c₃::T3 248 c₃::T3