Line
LazySets.LineModule.Line
— TypeLine{N, VN<:AbstractVector{N}} <: AbstractPolyhedron{N}
Type that represents a line of the form
\[ \{y ∈ ℝ^n: y = p + λd, λ ∈ ℝ\}\]
where $p$ is a point on the line and $d$ is its direction vector (not necessarily normalized).
Fields
p
– point on the lined
– direction
Examples
There are three constructors. The optional keyword argument normalize
(default: false
) can be used to normalize the direction of the resulting line to have norm 1 (w.r.t. the Euclidean norm).
- The default constructor takes the fields
p
andd
:
The line passing through the point $[-1, 2, 3]$ and parallel to the vector $[3, 0, -1]$:
julia> Line([-1.0, 2, 3], [3.0, 0, -1])
Line{Float64, Vector{Float64}}([-1.0, 2.0, 3.0], [3.0, 0.0, -1.0])
julia> Line([-1.0, 2, 3], [3.0, 0, -1]; normalize=true)
Line{Float64, Vector{Float64}}([-1.0, 2.0, 3.0], [0.9486832980505138, 0.0, -0.31622776601683794])
- The second constructor takes two points,
from
andto
, as keyword
arguments, and returns the line through them. See the algorithm section for details.
julia> Line(from=[-1.0, 2, 3], to=[2.0, 2, 2])
Line{Float64, Vector{Float64}}([-1.0, 2.0, 3.0], [3.0, 0.0, -1.0])
- The third constructor resembles
Line2D
and only works for two-dimensional
lines. It takes two inputs, a
and b
, and constructs the line such that $a ⋅ x = b$.
julia> Line([2.0, 0], 1.)
Line{Float64, Vector{Float64}}([0.5, 0.0], [0.0, 1.0])
Algorithm
Given two points $p ∈ ℝ^n$ and $q ∈ ℝ^n$, the line that passes through these two points is L:
{y ∈ ℝ^n: y = p + λ(q - p), λ ∈ ℝ}``.
Operations
LazySets.API.constraints_list
— Methodconstraints_list(X::LazySet)
Compute a list of linear constraints of a polyhedral set.
Input
X
– polyhedral set
Output
A list of the linear constraints of X
.
LazySets.API.constraints_list
— MethodExtended help
constraints_list(L::Line)
Output
A list containing 2n-2
half-spaces whose intersection is L
, where n
is the ambient dimension of L
.
LazySets.LineModule.direction
— Methoddirection(L::Line)
Return the direction of the line.
Input
L
– line
Output
The direction of the line.
Notes
The direction is not necessarily normalized. See normalize(::Line, ::Real)
/ normalize!(::Line, ::Real)
.
LazySets.API.isuniversal
— Methodisuniversal(X::LazySet, witness::Bool=false)
Check whether a set is universal.
Input
X
– setwitness
– (optional, default:false
) compute a witness if activated
Output
- If the
witness
option is deactivated:true
iff $X = ℝ^n$ - If the
witness
option is activated:(true, [])
iff $X = ℝ^n$(false, v)
iff $X ≠ ℝ^n$ for some $v ∉ X$
LazySets.API.isuniversal
— MethodExtended help
isuniversal(L::Line; [witness::Bool]=false)
Algorithm
- If
witness
isfalse
, the result istrue
if the ambient dimension is one,
and false
otherwise.
- If
witness
istrue
, the result is(true, [])
if the ambient dimension is
one, and (false, v)
where $v ∉ P$ otherwise.
LinearAlgebra.normalize
— Methodnormalize(L::Line{N}, p::Real=N(2)) where {N}
Normalize the direction of a line.
Input
L
– linep
– (optional, default:2.0
) vectorp
-norm used in the normalization
Output
A line whose direction has unit norm w.r.t. the given p
-norm.
Notes
See also normalize!(::Line, ::Real)
for the in-place version.
LinearAlgebra.normalize!
— Methodnormalize!(L::Line{N}, p::Real=N(2)) where {N}
Normalize the direction of a line storing the result in L
.
Input
L
– linep
– (optional, default:2.0
) vectorp
-norm used in the normalization
Output
A line whose direction has unit norm w.r.t. the given p
-norm.
Base.rand
— Methodrand(T::Type{<:LazySet}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing
)
Create a random set of the given set type.
Input
T
– set typeN
– (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 set of the given set type.
Base.rand
— MethodExtended help
rand(::Type{Line}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)
Algorithm
All numbers are normally distributed with mean 0 and standard deviation 1.
ReachabilityBase.Arrays.distance
— Methoddistance(x::AbstractVector, L::Line; [p]::Real=2.0)
Compute the distance between point x
and the line with respect to the given p
-norm.
Input
x
– point/vectorL
– linep
– (optional, default:2.0
) thep
-norm used;p = 2.0
corresponds to the usual Euclidean norm
Output
A scalar representing the distance between x
and the line L
.
Base.:∈
— Method∈(x::AbstractVector, X::LazySet)
Check whether a point lies in a set.
Input
x
– point/vectorX
– set
Output
true
iff $x ∈ X$.
Base.:∈
— MethodExtended help
∈(x::AbstractVector, L::Line)
Algorithm
The point $x$ belongs to the line $L : p + λd$ if and only if $x - p$ is proportional to the direction $d$.
LazySets.API.linear_map
— Methodlinear_map(M::AbstractMatrix, X::LazySet)
Compute the linear map $M · X$.
Input
M
– matrixX
– set
Output
A set representing the linear map $M · X$.
LazySets.API.linear_map
— MethodExtended help
linear_map(M::AbstractMatrix, L::Line)
Output
The line obtained by applying the linear map, if that still results in a line, or a Singleton
otherwise.
Algorithm
We apply the linear map to the point and direction of L
. If the resulting direction is zero, the result is a singleton.
Undocumented implementations:
Inherited from LazySet
:
area
complement
concretize
constraints
convex_hull
copy(::Type{LazySet})
diameter
eltype
eltype
isboundedtype
isoperation
norm
radius
rectify
reflect
singleton_list
surface
vertices
affine_map
exponential_map
is_interior_point
sample
scale
translate
cartesian_product
convex_hull
exact_sum
≈
==
isequivalent
⊂
minkowski_difference
Inherited from ConvexSet
:
Inherited from AbstractPolyhedron
: