Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ConvexHull docstring #2640

Merged
merged 2 commits into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions src/LazyOperations/ConvexHull.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ export ConvexHull, CH,
"""
ConvexHull{N, S1<:LazySet{N}, S2<:LazySet{N}} <: LazySet{N}

Type that represents the convex hull of the union of two convex sets.
Type that represents the convex hull of the union of two sets, that is the set

```math
Z = \\{z ∈ \\mathbb{R}^n : z = λx + (1-λ)y,\\qquad x ∈ X, y ∈ Y,λ ∈ [0, 1] \\}.
```

### Fields

- `X` -- convex set
- `Y` -- convex set
- `X` -- set
- `Y` -- set

### Notes

The `EmptySet` is the neutral element for `ConvexHull`.

This type is always convex.

### Examples

Convex hull of two 100-dimensional Euclidean balls:
Expand All @@ -37,7 +43,7 @@ struct ConvexHull{N, S1<:LazySet{N}, S2<:LazySet{N}} <: LazySet{N}
X::S1
Y::S2

# default constructor with dimension check
# default constructor with dimension check
function ConvexHull(X::LazySet{N}, Y::LazySet{N}) where {N}
@assert dim(X) == dim(Y) "sets in a convex hull must have the same dimension"
return new{N, typeof(X), typeof(Y)}(X, Y)
Expand Down Expand Up @@ -67,7 +73,7 @@ Return a new `ConvexHull` object with the arguments swapped.

### Input

- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets

### Output

Expand All @@ -80,15 +86,15 @@ end
"""
dim(ch::ConvexHull)

Return the dimension of a convex hull of two convex sets.
Return the dimension of a convex hull of two sets.

### Input

- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets

### Output

The ambient dimension of the convex hull of two convex sets.
The ambient dimension of the convex hull of two sets.
"""
function dim(ch::ConvexHull)
return dim(ch.X)
Expand All @@ -97,13 +103,12 @@ end
"""
σ(d::AbstractVector, ch::ConvexHull)

Return the support vector of a convex hull of two convex sets in a given
direction.
Return the support vector of the convex hull of two sets in a given direction.

### Input

- `d` -- direction
- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets

### Output

Expand All @@ -120,13 +125,12 @@ end
"""
ρ(d::AbstractVector, ch::ConvexHull)

Return the support function of a convex hull of two convex sets in a given
direction.
Return the support function of the convex hull of two sets in a given direction.

### Input

- `d` -- direction
- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets

### Output

Expand All @@ -139,11 +143,11 @@ end
"""
isbounded(ch::ConvexHull)

Determine whether a convex hull of two convex sets is bounded.
Determine whether the convex hull of two sets is bounded.

### Input

- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets

### Output

Expand All @@ -156,7 +160,7 @@ end
"""
isempty(ch::ConvexHull)

Return if a convex hull of two convex sets is empty or not.
Return if the convex hull of two sets is empty or not.

### Input

Expand All @@ -173,11 +177,11 @@ end
"""
vertices_list(ch::ConvexHull; apply_convex_hull::Bool=true, backend=nothing)

Return the list of vertices of the convex hull of two convex sets.
Return the list of vertices of the convex hull of two sets.

### Input

- `ch` -- convex hull of two convex sets
- `ch` -- convex hull of two sets
- `apply_convex_hull` -- (optional, default: `true`) if `true`, post-process the
vertices using a convex-hull algorithm
- `backend` -- (optional, default: `nothing`) backend for computing
Expand All @@ -197,6 +201,8 @@ function vertices_list(ch::ConvexHull;
return vlist
end

# concretization of a convex hull computes the (concrete) convex hull of the
# concretization of each wrapped set
function concretize(ch::ConvexHull)
return convex_hull(concretize(ch.X), concretize(ch.Y))
end