0
$\begingroup$

I have two regions like this

reg1 = ImplicitRegion[(-5. + x)^2 + (-3. + y)^2 <= 0.25 || (0.386909 + x Tan[25 \[Degree]] 
<= y <= 5.61309 - x Tan[25 \[Degree]] && 0 <= x <= 5.), {x, y}];

reg2 = ImplicitRegion[(-5. + x)^2 + (-3. + y)^2 <= 0.49 || (0.166233 + x Tan[25 \[Degree]]
<= y <= 5.83377 - x Tan[25 \[Degree]] && 0 <= x <= 5.), {x, y}];

Show[RegionPlot[reg1, AspectRatio -> Automatic], RegionPlot[reg2, AspectRatio -> Automatic]]

enter image description here

I need to see and work with their difference

RegionPlot[RegionDifference[reg2,reg1], AspectRatio -> Automatic]

but it brings about an error

RegionPlot::invplotreg: {RegionDifference[ImplicitRegion[Plus[<<2>>]^2+Plus[<<2>>]^2<=0.49||(0.166233 +Times[<<2>>]<=y<=5.83377 +Times[<<3>>]&&0<=x<=5.),{x,y}],ImplicitRegion[Plus[<<2>>]^2+Plus[<<2>>]^2<=0.25||(0.386909 +Times[<<2>>]<=y<=5.61309 +Times[<<3>>]&&0<=x<=5.),{x,y}]]} is not a valid region to plot. >>
$\endgroup$
  • $\begingroup$ What are w3 and w2? Maybe you meant reg2 and reg1; in that case RegionPlot[RegionDifference[reg2, reg1], AspectRatio -> Automatic] works with no problems. $\endgroup$ – corey979 Sep 23 '16 at 12:10
  • $\begingroup$ Yes, sorry, I meant reg2, reg1. But it still doesn't work for me. $\endgroup$ – T. Rihacek Sep 23 '16 at 12:51
  • $\begingroup$ Try quitting the kernel, maybe you have some old definitions. $\endgroup$ – corey979 Sep 23 '16 at 12:57
  • $\begingroup$ works here too, maybe a version issue. $\endgroup$ – george2079 Sep 23 '16 at 18:22
  • $\begingroup$ Works in version 11 on Windows 10 $\endgroup$ – Simon Woods Sep 23 '16 at 18:57
1
$\begingroup$
RegionDifference @@ (DiscretizeRegion /@ {reg2, reg1})

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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