From c42b8a4e640753f5b3ef3e89e37484a8dab9e825 Mon Sep 17 00:00:00 2001 From: mforets Date: Sun, 22 Jul 2018 17:48:46 -0300 Subject: [PATCH] add spaces and docs --- src/HalfSpace.jl | 2 +- src/LineSegment.jl | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/HalfSpace.jl b/src/HalfSpace.jl index 68c2c3263f..5ae5f7033c 100644 --- a/src/HalfSpace.jl +++ b/src/HalfSpace.jl @@ -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 \ No newline at end of file +end diff --git a/src/LineSegment.jl b/src/LineSegment.jl index 255f876d04..64aefab152 100644 --- a/src/LineSegment.jl +++ b/src/LineSegment.jl @@ -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) \ No newline at end of file +""" + 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)