Skip to main content
deleted 50 characters in body
Source Link

Let's look at a simpler example to show the problem. We'll create a DelaunyeyDelaunay mesh from some random points, and generate a RegionBoundary from that.

In version 10.4:

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = RegionBoundary[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[MeshCoordinates@mr2, 
  PlotStyle -> Directive[Thick, Red]]]

enter image description here10.4 output

compared with version 10.3.1 (or any previous version 10.x)

enter image description hereoutput from earlier versions

Let's look at the InputForm for this in 10.4,

mr2 // InputForm


MeshRegion[{.....}, {Line[{{2, 6}, {1, 2}, {4, 1}, {3, 5}, {6, 3}, {5, 4}}]}]

versus for 10.3,

MeshRegion[{.....}, {Line[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6,1}}]}]

How to get around this? Create a BoundaryMeshRegion and extract the polygon points from that (the points of a polygon must be in the right order or it's nonsense). The following gives identical results in 10.3 and 10.4

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = BoundaryDiscretizeRegion[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[First@First@MeshPrimitives[mr2, 2], 
  PlotStyle -> Directive[Thick, Red]]]

enter image description herefixed version

And, applied to the OP,

ListLinePlot@First@First@MeshPrimitives[#, 2] &@
 BoundaryDiscretizeRegion@alphaShapes2DC[pts, 5.5]

enter image description herethe alpha shape

Let's look at a simpler example to show the problem. We'll create a Delaunyey mesh from some random points, and generate a RegionBoundary from that.

In version 10.4:

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = RegionBoundary[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[MeshCoordinates@mr2, 
  PlotStyle -> Directive[Thick, Red]]]

enter image description here

compared with version 10.3.1 (or any previous version 10.x)

enter image description here

Let's look at the InputForm for this in 10.4,

mr2 // InputForm


MeshRegion[{.....}, {Line[{{2, 6}, {1, 2}, {4, 1}, {3, 5}, {6, 3}, {5, 4}}]}]

versus for 10.3,

MeshRegion[{.....}, {Line[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6,1}}]}]

How to get around this? Create a BoundaryMeshRegion and extract the polygon points from that (the points of a polygon must be in the right order or it's nonsense). The following gives identical results in 10.3 and 10.4

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = BoundaryDiscretizeRegion[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[First@First@MeshPrimitives[mr2, 2], 
  PlotStyle -> Directive[Thick, Red]]]

enter image description here

And, applied to the OP,

ListLinePlot@First@First@MeshPrimitives[#, 2] &@
 BoundaryDiscretizeRegion@alphaShapes2DC[pts, 5.5]

enter image description here

Let's look at a simpler example to show the problem. We'll create a Delaunay mesh from some random points, and generate a RegionBoundary from that.

In version 10.4:

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = RegionBoundary[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[MeshCoordinates@mr2, 
  PlotStyle -> Directive[Thick, Red]]]

10.4 output

compared with version 10.3.1 (or any previous version 10.x)

output from earlier versions

Let's look at the InputForm for this in 10.4,

mr2 // InputForm


MeshRegion[{.....}, {Line[{{2, 6}, {1, 2}, {4, 1}, {3, 5}, {6, 3}, {5, 4}}]}]

versus for 10.3,

MeshRegion[{.....}, {Line[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6,1}}]}]

How to get around this? Create a BoundaryMeshRegion and extract the polygon points from that (the points of a polygon must be in the right order or it's nonsense). The following gives identical results in 10.3 and 10.4

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = BoundaryDiscretizeRegion[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[First@First@MeshPrimitives[mr2, 2], 
  PlotStyle -> Directive[Thick, Red]]]

fixed version

And, applied to the OP,

ListLinePlot@First@First@MeshPrimitives[#, 2] &@
 BoundaryDiscretizeRegion@alphaShapes2DC[pts, 5.5]

the alpha shape

Source Link
Jason B.
  • 70.2k
  • 3
  • 144
  • 297

Let's look at a simpler example to show the problem. We'll create a Delaunyey mesh from some random points, and generate a RegionBoundary from that.

In version 10.4:

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = RegionBoundary[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[MeshCoordinates@mr2, 
  PlotStyle -> Directive[Thick, Red]]]

enter image description here

compared with version 10.3.1 (or any previous version 10.x)

enter image description here

Let's look at the InputForm for this in 10.4,

mr2 // InputForm


MeshRegion[{.....}, {Line[{{2, 6}, {1, 2}, {4, 1}, {3, 5}, {6, 3}, {5, 4}}]}]

versus for 10.3,

MeshRegion[{.....}, {Line[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6,1}}]}]

How to get around this? Create a BoundaryMeshRegion and extract the polygon points from that (the points of a polygon must be in the right order or it's nonsense). The following gives identical results in 10.3 and 10.4

SeedRandom[4];
mr1 = DelaunayMesh[RandomReal[1, {15, 2}]];
mr2 = BoundaryDiscretizeRegion[mr1];
Show[mr1, HighlightMesh[mr2, 1], 
 ListLinePlot[First@First@MeshPrimitives[mr2, 2], 
  PlotStyle -> Directive[Thick, Red]]]

enter image description here

And, applied to the OP,

ListLinePlot@First@First@MeshPrimitives[#, 2] &@
 BoundaryDiscretizeRegion@alphaShapes2DC[pts, 5.5]

enter image description here