Translation
LazySets.Translation — TypeTranslation{N, VN<:AbstractVector{N}, S<:LazySet{N}} <: AbstractAffineMap{N, S}Type that represents a lazy translation.
The translation of set X along vector v is the map:
\[x ↦ x + v,\qquad x ∈ X\]
A translation is a special case of an affine map $A x + b, x ∈ X$ where the linear map $A$ is the identity matrix and the translation vector $b = v$.
Fields
X– convex setv– vector that defines the translation
Example
julia> X = BallInf([2.0, 2.0, 2.0], 1.0);
julia> v = [1.0, 0.0, 0.0]; # translation along dimension 1
julia> tr = Translation(X, v);
julia> typeof(tr)
Translation{Float64,Array{Float64,1},BallInf{Float64,Array{Float64,1}}}
julia> tr.X
BallInf{Float64,Array{Float64,1}}([2.0, 2.0, 2.0], 1.0)
julia> tr.v
3-element Array{Float64,1}:
1.0
0.0
0.0The sum operator + is overloaded to create translations:
julia> X + v == Translation(X, v)
trueAnd so does the Minkowski sum operator, ⊕:
julia> X ⊕ v == Translation(X, v)
trueThe translation of a translation is performed immediately:
julia> tr = (X+v)+v
Translation{Float64,Array{Float64,1},BallInf{Float64,Array{Float64,1}}}(BallInf{Float64,Array{Float64,1}}([2.0, 2.0, 2.0], 1.0), [2.0, 0.0, 0.0])
julia> tr.v
3-element Array{Float64,1}:
2.0
0.0
0.0The dimension of a translation is obtained with the dim function:
julia> dim(tr)
3For the support vector (resp. support function) along vector d, use σ and ρ respectively:
julia> σ([1.0, 0.0, 0.0], tr)
3-element Array{Float64,1}:
5.0
3.0
3.0
julia> ρ([1.0, 0.0, 0.0], tr)
5.0See the docstring of each of these functions for details.
The an_element function is useful to obtain an element of a translation:
julia> e = an_element(tr)
3-element Array{Float64,1}:
4.0
2.0
2.0The lazy linear map of a translation is an affine map, since the following simplification rule applies: $M * (X ⊕ v) = (M * X) ⊕ (M * v)$:
julia> using LinearAlgebra: I
julia> M = Matrix(2.0I, 3, 3);
julia> Q = M * tr;
julia> Q isa AffineMap && Q.M == M && Q.X == tr.X && Q.v == 2 * tr.v
trueUse the isempty method to query if the translation is empty; it falls back to the isempty method of the wrapped set:
julia> isempty(tr)
falseThe list of constraints of the translation of a polyhedron (in general, a set whose constraints_list is available) can be computed from a lazy translation:
julia> constraints_list(tr)
6-element Array{HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}},1}:
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([1.0, 0.0, 0.0], 5.0)
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 1.0, 0.0], 3.0)
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 0.0, 1.0], 3.0)
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([-1.0, 0.0, 0.0], -3.0)
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, -1.0, 0.0], -1.0)
HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 0.0, -1.0], -1.0)Base.:+ — Method+(X::LazySet, v::AbstractVector)Convenience constructor for a translation.
Input
X– convex setv– vector
Output
The symbolic translation of $X$ along vector $v$.
LazySets.:⊕ — Method⊕(X::LazySet, v::AbstractVector)Unicode alias constructor ⊕ (oplus) for the lazy translation operator.
LazySets.ρ — Methodρ(d::AbstractVector, tr::Translation)Return the support function of a translation.
Input
d– directiontr– translation
Output
The support function in the given direction.
LazySets.σ — Methodσ(d::AbstractVector, tr::Translation)Return the support vector of a translation.
Input
d– directiontr– translation
Output
The support vector in the given direction. If the direction has norm zero, the result depends on the wrapped set.
LazySets.an_element — Methodan_element(tr::Translation)Return some element of a translation.
Input
tr– translation
Output
An element in the translation.
Notes
This function first asks for an_element function of the wrapped set, then translates this element according to the given translation vector.
LazySets.constraints_list — Methodconstraints_list(tr::Translation)Return the list of constraints of the translation of a set.
Input
tr– lazy translation of a polyhedron
Output
The list of constraints of the translation.
Notes
We assume that the set wrapped by the lazy translation X offers a method constraints_list(⋅).
Algorithm
Let the translation be defined by the set of points y such that y = x + v for all x ∈ X. Then, each defining halfspace a⋅x ≤ b is transformed to a⋅y ≤ b + a⋅v.
LazySets.linear_map — Methodlinear_map(M::AbstractMatrix, tr::Translation)Concrete linear map of a polyhedron in constraint representation.
Input
M– matrixtr– translation of a convex set
Output
A concrete set corresponding to the linear map. The type of the result depends on the type of the set wrapped by tr.
Algorithm
We compute translate(linear_map(M, tr.X), M * tr.v).
Base.:∈ — Method∈(x::AbstractVector, tr::Translation)Check whether a given point is contained in the translation of a convex set.
Input
x– point/vectortr– translation of a convex set
Output
true iff $x ∈ tr$.
Algorithm
This implementation relies on the set membership function for the wrapped set tr.X, since $x ∈ X ⊕ v$ iff $x - v ∈ X$.
Inherited from AbstractAffineMap:
Inherited from LazySet: