Skip to main content
deleted 25 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find all good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform""trans" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform""trans" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"]"trans"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find all good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find all good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "trans" -> trans],
      Property[b \[DirectedEdge] a, "trans" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "trans"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

added 4 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find all good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find all good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

added 17 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find good quality two line segment rigid mappings between polygons without overlap with each other (at least much). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

Assuming polygons follow the same (clockwise or counterclockwise) vertex order, find good quality two line segment rigid mappings between polygons without overlap with each other (at least much overlap, that is). Construct a graph of these mappings and apply appropriate transforms to polygons by finding transform paths from one polygon to all others. (In this case, these paths are pretty simple).

ReplaceList[MeshPrimitives[#, 2] & /@ meshes, {___,
    {a : Polygon[{___, ap : Repeated[_, {3}], ___}]}, ___,
    {b : Polygon[{___, bp : Repeated[_, {3}], ___}]}, ___} :>
   Module[{err, trans},
    {err, trans} = 
     Chop[FindGeometricTransform[{ap}, Reverse@{bp}, 
       TransformationClass -> "Rigid", Method -> "Linear"], 0.001];
    {Property[a \[DirectedEdge] b, "transform" -> trans],
      Property[b \[DirectedEdge] a, 
       "transform" -> InverseFunction@trans]} /;
     err < 1 && 
      Quiet@Area[
         RegionIntersection[BoundaryDiscretizeRegion@a, 
          BoundaryDiscretizeRegion@TransformedRegion[b, trans]]] < 1]] //
 With[{g = Graph@Flatten@#},
   Graphics[{FaceForm[], EdgeForm@Thick, First@VertexList@g,
     GeometricTransformation[#,
        Composition @@ (PropertyValue[{g, DirectedEdge @@ #}, "transform"] & /@ 
           Partition[FindShortestPath[g, First@VertexList@g, #], 2, 1])] & /@
      Rest@VertexList@g}]] &

enter image description here

deleted 1 character in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95
Loading
deleted 17 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95
Loading
deleted 6 characters in body
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95
Loading
Source Link
kirma
  • 19.1k
  • 1
  • 55
  • 95
Loading