5
$\begingroup$

Bug introduced in 10.1 and fixed in 10.3.0


I want to find the intersection (region) of 2 polygons. I use RegionInstersection but it only works for some sizes, for example, when c=.5 it gives the correct result, but with c=.4 it only finds a line as intersection.

Area[r3[.5]] works fine...

Area[r3[.4]] does not work...

What is wrong?

b = 15.0;
d = 4.0;
lbp = 40.0;
d1E = 2.;
l1E = 7.0;
d1D = d1E;
l1D = 5.0;

r1 = Polygon[{{0, 0}, {lbp/2 - l1D, 0}, {lbp/2, d1D}, {lbp/2, 
     d}, {-(lbp/2), d}, {-(lbp/2), d1E}, {-(lbp/2) + l1E, 0}}];
r2[c_] := Rectangle[{-1.1 lbp/2, -1.5}, {1.1 lbp/2, c}];
r3[c_] := RegionIntersection[r1, r2[c]];
$\endgroup$
1
  • 5
    $\begingroup$ This is a bug. For a workaround, use exact numbers everywhere or discretize r1 and r2[c] first. $\endgroup$
    – ilian
    Jul 8, 2015 at 2:15

1 Answer 1

4
$\begingroup$

This bug has been fixed as of Mathematica 10.3.

b = 15.0; d = 4.0; lbp = 40.0; d1E = 2.; l1E = 7.0; d1D = d1E; l1D = 5.0;
r1 = Polygon[{{0, 0}, {lbp/2 - l1D, 0}, {lbp/2, d1D}, {lbp/2, d}, 
              {-(lbp/2), d}, {-(lbp/2), d1E}, {-(lbp/2) + l1E, 0}}];
r2[c_] := Rectangle[{-1.1 lbp/2, -1.5}, {1.1 lbp/2, c}];
r3[c_] := RegionIntersection[r1, r2[c]];
{Area[r3[.5]], Area[r3[.4]]}

(* {14.75, 11.68} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.