Skip to content

Commit

Permalink
type-paramterize Segment eval
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Beggs committed Jan 19, 2024
1 parent 74d0f32 commit 56c0e91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/polytopes/segment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ center(s::Segment{Dim,T}) where {Dim,T} = s(T(0.5))
Base.isapprox(s₁::Segment, s₂::Segment; kwargs...) =
all(isapprox(v₁, v₂; kwargs...) for (v₁, v₂) in zip(s₁.vertices, s₂.vertices))

function (s::Segment)(t)
if t < 0 || t > 1
function (s::Segment{Dim,T})(t) where {Dim,T}
if t < zero(T) || t > one(T)
throw(DomainError(t, "s(t) is not defined for t outside [0, 1]."))
end
a, b = s.vertices
Expand Down

0 comments on commit 56c0e91

Please sign in to comment.