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 #272

Closed
mforets opened this issue Mar 2, 2018 · 2 comments
Closed

Fix hyperrectangle plot #272

mforets opened this issue Mar 2, 2018 · 2 comments
Assignees
Labels
bug 🐛 Something isn't working

Comments

@mforets
Copy link
Member

mforets commented Mar 2, 2018

for example, h = Hyperrectangle(center=[0.005, 1.1], radius=[0.005, 0.861785]) displays two triangles.

@mforets mforets added the bug 🐛 Something isn't working label Mar 2, 2018
@schillic
Copy link
Member

schillic commented Mar 3, 2018

vertices_list returns the vertices neither in clockwise nor counter-clockwise fashion.

julia> h = Hyperrectangle([1., 2.], [3., 4.])
LazySets.Hyperrectangle{Float64}([1.0, 2.0], [3.0, 4.0])
julia> vertices_list(h)
4-element Array{Array{Float64,1},1}:
 [4.0, 6.0]  
 [-2.0, 6.0] 
 [4.0, -2.0] 
 [-2.0, -2.0]

I see two solutions:

  1. Change the vertices_list implementation (also of all other AbstractPolytope types).
    If it makes the implementation more expensive, we should add a new function vertices_list_ccw and use this one for plotting. The function can be restricted to 2D sets if that helps.
  2. Change the plot recipe such that it sorts the vertices. Algorithm: Start with any vertex, compute the angle to all other vertices, choose the smallest one, and draw the line.

@schillic schillic added the discussion 🗣️ Requires human input label Mar 3, 2018
@mforets
Copy link
Member Author

mforets commented Mar 3, 2018

good, i would try with your solution 2 relying on convex_hull.

@schillic schillic removed the discussion 🗣️ Requires human input label Mar 3, 2018
@mforets mforets self-assigned this Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants