Mercurial > repos > public > sbplib_julia
comparison src/Grids/geometry.jl @ 2014:6478c29effce feature/grids/geometry_functions
Add docstring for Arc and arc
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 09 May 2025 07:42:21 +0200 |
parents | 7895b509f9bf |
children |
comparison
equal
deleted
inserted
replaced
2013:7895b509f9bf | 2014:6478c29effce |
---|---|
162 end | 162 end |
163 | 163 |
164 """ | 164 """ |
165 Arc(C::Circle, θ₀, θ₁) | 165 Arc(C::Circle, θ₀, θ₁) |
166 | 166 |
167 # TODO | 167 A circular arc as a callable object. The arc is around the circle `C` between |
168 angles `θ₀` and `θ₁` and is paramatrized between 0 and 1. | |
169 | |
170 See also: [`arc`](@ref), [`Circle`](@ref). | |
168 """ | 171 """ |
169 function Arc(C, θ₀, θ₁) | 172 function Arc(C, θ₀, θ₁) |
170 r, θ₀, θ₁ = promote(C.r, θ₀, θ₁) | 173 r, θ₀, θ₁ = promote(C.r, θ₀, θ₁) |
171 | 174 |
172 return Arc(Circle(C.c, r), θ₀, θ₁) | 175 return Arc(Circle(C.c, r), θ₀, θ₁) |
184 | 187 |
185 | 188 |
186 """ | 189 """ |
187 arc(a,b,r) | 190 arc(a,b,r) |
188 | 191 |
189 # TODO | 192 A circular arc between the points `a` and `b` with radius `abs(r)`. If `r > 0` |
193 the arc goes counter clockwise and if `r<0` the arc goes clockwise. The arc is | |
194 parametrized such that if `A = arc(a,b,r)` then `A(0)` corresponds to `a` and | |
195 `A(1)` to `b`. | |
196 | |
197 See also: [`Arc`](@ref), [`Circle`](@ref). | |
190 """ | 198 """ |
191 function arc(a,b,r) | 199 function arc(a,b,r) |
192 if abs(r) < norm(b-a)/2 | 200 if abs(r) < norm(b-a)/2 |
193 throw(DomainError(r, "arc was called with radius r = $r smaller than half the distance between the points.")) | 201 throw(DomainError(r, "arc was called with radius r = $r smaller than half the distance between the points.")) |
194 end | 202 end |