JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
174 stars 27 forks source link

Add maximum_radius_with_center #232

Closed blegat closed 3 years ago

blegat commented 3 years ago

cc @ferrolho

codecov[bot] commented 3 years ago

Codecov Report

Merging #232 (5ab5e60) into master (a5b4772) will decrease coverage by 0.71%. The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #232      +/-   ##
==========================================
- Coverage   90.16%   89.45%   -0.72%     
==========================================
  Files          38       38              
  Lines        2532     2333     -199     
==========================================
- Hits         2283     2087     -196     
+ Misses        249      246       -3     
Impacted Files Coverage Δ
src/center.jl 94.02% <88.23%> (-2.34%) :arrow_down:
src/polyhedra_to_lp_bridge.jl 55.17% <0.00%> (-4.21%) :arrow_down:
src/projection_opt.jl 65.51% <0.00%> (-2.23%) :arrow_down:
src/representation.jl 62.50% <0.00%> (-2.21%) :arrow_down:
src/doubledescription.jl 74.41% <0.00%> (-1.67%) :arrow_down:
src/defaultlibrary.jl 93.18% <0.00%> (-1.47%) :arrow_down:
src/lphrep.jl 88.09% <0.00%> (-1.27%) :arrow_down:
src/decompose.jl 70.79% <0.00%> (-1.24%) :arrow_down:
src/elements.jl 84.40% <0.00%> (-1.24%) :arrow_down:
src/repop.jl 90.52% <0.00%> (-1.22%) :arrow_down:
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a5b4772...5ab5e60. Read the comment docs.

ferrolho commented 3 years ago

While writing the basic tests for this I noticed a case for which maximum_radius_with_center returned a negative radius. We may want to throw an error for such cases.

Example:

julia> p = hrep([1 1; -1 -1], [0, -1])
H-representation MixedMatHRep{Int64,Array{Int64,2}}:
2-element iterator of HalfSpace{Int64,Array{Int64,1}}:
 HalfSpace([1, 1], 0)
 HalfSpace([-1, -1], -1)

julia> r = Polyhedra.maximum_radius_with_center(p, zeros(2))
-0.7071067811865475