Line2D

LazySets.Line2DType
Line2D{N, VN<:AbstractVector{N}} <: AbstractPolyhedron{N}

Type that represents a line in 2D of the form $a⋅x = b$ (i.e., a special case of a Hyperplane).

Fields

  • a – normal direction (non-zero)
  • b – constraint

Examples

The line $y = -x + 1$:

julia> Line2D([1., 1.], 1.)
Line2D{Float64, Vector{Float64}}([1.0, 1.0], 1.0)
source
LazySets.dimMethod
dim(L::Line2D)

Return the ambient dimension of a line.

Input

  • L – line

Output

The ambient dimension of the line, which is 2.

source
LazySets.σMethod
σ(d::AbstractVector, L::Line2D)

Return the support vector of a line in a given direction.

Input

  • d – direction
  • L – line

Output

The support vector in the given direction, which is defined the same way as for the more general Hyperplane.

source
Base.:∈Method
∈(x::AbstractVector, L::Line2D)

Check whether a given point is contained in a line.

Input

  • x – point/vector
  • L – line

Output

true iff x ∈ L.

Algorithm

The point $x$ belongs to the line if and only if $a⋅x = b$ holds.

source
LazySets.an_elementMethod
an_element(S::ConvexSet{N}) where {N}

Return some element of a convex set.

Input

  • S – convex set

Output

An element of a convex set.

Algorithm

An element of the set is obtained by evaluating its support vector along direction $[1, 0, …, 0]$.

source
an_element(P::AbstractPolyhedron{N};
           [solver]=default_lp_solver(N)) where {N}

Return some element of a polyhedron.

Input

  • P – polyhedron
  • solver – (optional, default: default_lp_solver(N)) LP solver

Output

An element of the polyhedron, or an error if the polyhedron is empty.

Algorithm

An element of the polyhedron is obtained by solving a feasibility linear program.

source
an_element(L::Line2D{N}) where {N}

Return some element of a line.

Input

  • L – line

Output

An element on the line.

Algorithm

If the $b$ value of the line is zero, the result is the origin. Otherwise the result is some $x = [x1, x2]$ such that $a·[x1, x2] = b$. We first find out in which dimension $a$ is nonzero, say, dimension 1, and then choose $x1 = 1$ and accordingly $x2 = \frac{b - a1}{a2}$.

source
an_element(U::Universe{N}) where {N}

Return some element of a universe.

Input

  • U – universe

Output

The origin.

source
Base.randMethod
rand(::Type{Line2D}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
     [rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)

Create a random line.

Input

  • Line2D – type for dispatch
  • N – (optional, default: Float64) numeric type
  • dim – (optional, default: 2) dimension
  • rng – (optional, default: GLOBAL_RNG) random number generator
  • seed – (optional, default: nothing) seed for reseeding

Output

A random line.

Algorithm

All numbers are normally distributed with mean 0 and standard deviation 1. Additionally, the constraint a is nonzero.

source
LazySets.isuniversalFunction
isuniversal(L::Line2D, [witness]::Bool=false)

Check whether a line is universal.

Input

  • P – line
  • witness – (optional, default: false) compute a witness if activated

Output

  • If witness option is deactivated: false
  • If witness option is activated: (false, v) where $v ∉ P$

Algorithm

Witness production falls back to isuniversal(::Hyperplane).

source
Base.isemptyMethod
isempty(L::Line2D)

Return if a line is empty or not.

Input

  • L – line

Output

false.

source
LazySets.constrained_dimensionsMethod
constrained_dimensions(L::Line2D)

Return the indices in which a line is constrained.

Input

  • L – line

Output

A vector of ascending indices i such that the line is constrained in dimension i.

Examples

A line with constraint $x1 = 0$ is constrained in dimension 1 only.

source
LazySets.constraints_listMethod
constraints_list(L::Line2D)

Return the list of constraints of a line.

Input

  • L – line

Output

A list containing two half-spaces.

source
LazySets.translateMethod
translate(L::Line2D, v::AbstractVector; [share]::Bool=false)

Translate (i.e., shift) a line by a given vector.

Input

  • L – line
  • v – translation vector
  • share – (optional, default: false) flag for sharing unmodified parts of the original set representation

Output

A translated line.

Notes

The normal vector of the line (vector a in a⋅x = b) is shared with the original line if share == true.

Algorithm

A line $a⋅x = b$ is transformed to the line $a⋅x = b + a⋅v$. In other words, we add the dot product $a⋅v$ to $b$.

source
LazySets.projectMethod
project(x::AbstractVector, L::Line2D)

Project a point onto a line.

Input

  • x – point
  • L – line

Output

The projection of x onto L.

Algorithm

The projection of $x$ onto the line of the form $a⋅x = b$ is

\[ x - \dfrac{a (a⋅x - b)}{‖a‖²}\]

source

Inherited from ConvexSet: