# The difference area between two regions

I have two polygons poly1 and poly0, I need the difference area of them. Below is my trial:

poly0 = Import["t0.txt", "Data"]
poly1 = Import["t1.txt", "Data"]

Graphics[{Red, Polygon@poly0 , Green, Polygon@poly1}]


RegionDifference[BoundaryDiscretizeRegion[Polygon@poly1],
BoundaryDiscretizeRegion[Polygon@poly0]]


Obviously, the RegionDifference cannot work normally.

data

https://www.dropbox.com/s/6inghzi80uembji/t0.txt?dl=0

https://www.dropbox.com/s/w2j0iui9alzwdsm/t1.txt?dl=0

• Are you sure you don't have some old definitions? Try clearing all global variables or quitting the kernel. I have no problem with getting the RegionMeasure of RegionMeasure as in your post, as well as in Mauricio's answer. – corey979 Nov 14 '16 at 9:24
• @corey979 Yes, In addtion, I guess your Mathematica version is V11.0.1, rather than 10.4 or 11.0.0 – user123 Nov 14 '16 at 9:45
• No, I'm on 10.4.1 for Linux x86 (64-bit). – corey979 Nov 14 '16 at 9:47

Try using DiscretizeRegion first

r1 = DiscretizeRegion@Polygon@poly0;
r2 = DiscretizeRegion@Polygon@poly1;
rd = RegionDifference[r2, r1]
RegionMeasure@rd


• I got this i.stack.imgur.com/SHfE5.png in Mma 10.4 – user123 Nov 14 '16 at 7:44
• hmmm .... weird .... I am using Mathematica 11. Perhaps there were some problems with RegionDifference in 10.4. Sorry, no idea in that case – Mauricio Fernández Nov 14 '16 at 7:51
• That's all right:) Mma 11 also fails to return the result you give. – user123 Nov 14 '16 at 7:55
• What?? In Mma 11 it does not work for you? Did you just copy paste the code I posted? It should work with Mma 11. – Mauricio Fernández Nov 14 '16 at 7:59
• Yes, here is the snapshot i.stack.imgur.com/GFm4r.png – user123 Nov 14 '16 at 8:05