Line
LazySets.Line
— Type.Line{N<:Real, 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> Line([1., 1.], 1.)
Line{Float64,Array{Float64,1}}([1.0, 1.0], 1.0)
LazySets.dim
— Method.dim(L::Line)
Return the ambient dimension of a line.
Input
L
– line
Output
The ambient dimension of the line, which is 2.
LazySets.σ
— Method.σ(d::AbstractVector{N}, L::Line{N}) where {N<:Real}
Return the support vector of a line in a given direction.
Input
d
– directionL
– line
Output
The support vector in the given direction, which is defined the same way as for the more general Hyperplane
.
Base.:∈
— Method.∈(x::AbstractVector{N}, L::Line{N}) where {N<:Real}
Check whether a given point is contained in a line.
Input
x
– point/vectorL
– line
Output
true
iff x ∈ L
.
Algorithm
The point $x$ belongs to the line if and only if $a⋅x = b$ holds.
LazySets.an_element
— Method.an_element(L::Line{N}) where {N<:Real}
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}$.
Base.rand
— Method.rand(::Type{Line}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)
Create a random line.
Input
Line
– type for dispatchN
– (optional, default:Float64
) numeric typedim
– (optional, default: 2) dimensionrng
– (optional, default:GLOBAL_RNG
) random number generatorseed
– (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.
LazySets.isbounded
— Method.isbounded(L::Line)
Determine whether a line is bounded.
Input
L
– line
Output
false
.
LazySets.isuniversal
— Method.isuniversal(L::Line{N}, [witness]::Bool=false) where {N<:Real}
Check whether a line is universal.
Input
P
– linewitness
– (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)
.
Base.isempty
— Method.isempty(L::Line)
Return if a line is empty or not.
Input
L
– line
Output
false
.
LazySets.constrained_dimensions
— Method.constrained_dimensions(L::Line{N}) where {N<:Real}
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.
LazySets.constraints_list
— Method.constraints_list(L::Line{N}) where {N<:Real}
Return the list of constraints of a line.
Input
L
– line
Output
A list containing two half-spaces.
LazySets.translate
— Method.translate(L::Line{N}, v::AbstractVector{N}; share::Bool=false
) where {N<:Real}
Translate (i.e., shift) a line by a given vector.
Input
L
– linev
– translation vectorshare
– (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$.
Inherited from LazySet
: