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

Fix hyperrectangle plot #276

Merged
merged 4 commits into from
Mar 3, 2018
Merged
Changes from 3 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
18 changes: 16 additions & 2 deletions src/plot_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ julia> B = BallInf(ones(2), 0.1)
julia> plot(2.0 * B)
```

### Algorithm

For any 2D lazy set we compute its box overapproximation, followed by the list of
vertices. A post-processing `convex_hull` is applied to the vertices list;
this ensures that the shaded area inside the convex hull of the vertices is covered
correctly.

### Notes

This recipe detects if the axis-aligned approximation is such that the first two
Expand All @@ -30,7 +37,7 @@ plotting singletons.
color="blue", label="", grid=true, alpha=0.5)

P = Approximations.overapproximate(S)
vlist = hcat(vertices_list(P)...).'
vlist = hcat(convex_hull(vertices_list(P))...).'
(x, y) = vlist[:, 1], vlist[:, 2]

seriestype := norm(vlist[1, :] - vlist[2, :]) ≈ 0 ? :scatter : :shape
Expand All @@ -56,6 +63,13 @@ julia> B1 = BallInf(zeros(2), 0.4)
julia> B2 = BallInf(ones(2), 0.4)
julia> plot([B1, B2])
```

### Algorithm

For each 2D lazy set in the array we compute its box overapproximation, followed
by the list of vertices. A post-processing `convex_hull` is applied to the vertices list;
this ensures that the shaded area inside the convex hull of the vertices is covered
correctly.
"""
@recipe function plot_lazyset(arr::Vector{<:LazySet};
seriescolor="blue", label="", grid=true,
Expand All @@ -65,7 +79,7 @@ julia> plot([B1, B2])

for S in arr
Pi = Approximations.overapproximate(S)
vlist = hcat(vertices_list(Pi)...).'
vlist = hcat(convex_hull(vertices_list(P))...).'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pi?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops

@series (x, y) = vlist[:, 1], vlist[:, 2]
end
end
Expand Down