Skip to content

Commit

Permalink
add spaces and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mforets authored and schillic committed Jul 25, 2018
1 parent 85b6b32 commit c42b8a4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/HalfSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ See the documentation of `halfspace_left`.
function halfspace_right(p::AbstractVector{N},
q::AbstractVector{N})::HalfSpace{N} where {N<:Real}
return halfspace_right(q, p)
end
end
32 changes: 31 additions & 1 deletion src/LineSegment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,36 @@ function ∈(x::AbstractVector{N}, L::LineSegment{N})::Bool where {N<:Real}
min(L.p[2], L.q[2]) <= x[2] <= max(L.p[2], L.q[2])
end

"""
halfspace_left(L::LineSegment)
Return a half-space describing the 'left' of a two-dimensional line segment through
two points.
### Input
- `L` -- line segment
### Output
The half-space whose boundary goes through the two points `p` and `q` and which
describes the left-hand side of the directed line segment `pq`.
"""
halfspace_left(L::LineSegment) = halfspace_left(L.p, L.q)

halfspace_right(L::LineSegment) = halfspace_right(L.p, L.q)
"""
halfspace_right(L::LineSegment)
Return a half-space describing the 'right' of a two-dimensional line segment through
two points.
### Input
- `L` -- line segment
### Output
The half-space whose boundary goes through the two points `p` and `q` and which
describes the right-hand side of the directed line segment `pq`.
"""
halfspace_right(L::LineSegment) = halfspace_right(L.p, L.q)

0 comments on commit c42b8a4

Please sign in to comment.