Skip to main content
added 126 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
polygons = Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]];
polygondata = With[{x = MeshCoordinates[mesh]}, Map[
    p \[Function] Partition[x[[p]], 2, 1, 1],
    polygons
    ]];
areas = 0.5 Total[Map[Det, polygondata, {2}], {2}];
circumferences = Total[Map[Norm, Differences /@ polygondata, {2}], {2}];

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[mesh, MeshCellLabel -> Map[
   i \[Function] ({2, i} -> Tooltip[iTooltip[
       i,
       Grid[{
         {"vertices""Vertices", polygons[[i]]},
         {"area""Vertex Coordinates", polygondata[[i, All, 1]]},
         {"Area", areas[[i]]},
         {"circumference""Perimeter", circumferences[[i]]}
         },
        Alignment -> {Left, Top}
        ]
       ]
     ),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
polygons = Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]];
polygondata = With[{x = MeshCoordinates[mesh]}, Map[
    p \[Function] Partition[x[[p]], 2, 1, 1],
    polygons
    ]];
areas = 0.5 Total[Map[Det, polygondata, {2}], {2}];
circumferences = Total[Map[Norm, Differences /@ polygondata, {2}], {2}];

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[mesh, MeshCellLabel -> Map[
   i \[Function] ({2, i} -> Tooltip[i,
       Grid[{
         {"vertices", polygons[[i]]},
         {"area", areas[[i]]},
         {"circumference", circumferences[[i]]}
         }]
       ]
     ),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
polygons = Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]];
polygondata = With[{x = MeshCoordinates[mesh]}, Map[
    p \[Function] Partition[x[[p]], 2, 1, 1],
    polygons
    ]];
areas = 0.5 Total[Map[Det, polygondata, {2}], {2}];
circumferences = Total[Map[Norm, Differences /@ polygondata, {2}], {2}];

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[mesh, MeshCellLabel -> Map[
   i \[Function] ({2, i} -> Tooltip[
       i,
       Grid[{
         {"Vertices", polygons[[i]]},
         {"Vertex Coordinates", polygondata[[i, All, 1]]},
         {"Area", areas[[i]]},
         {"Perimeter", circumferences[[i]]}
         },
        Alignment -> {Left, Top}
        ]
       ]
     ),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
added 141 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323

Towards the areas: You can obtain them, e.g., like this

areaspolygons = Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]];
polygondata = With[{x = MeshCoordinates[mesh]},
  0.5 Map[
    p \[Function] Total[Det /@ Partition[x[[p]], 2, 1, 1]]1],
   Join @@polygons
 MeshCells[mesh, 2, "Multicells" ->]];
areas True][[All,= 1]]
0.5 Total[Map[Det, polygondata, {2}]
 , ]{2}];

or like this

areascircumferences = PropertyValue[{meshTotal[Map[Norm, Differences /@ polygondata, {2}], MeshCellMeasure]{2}];

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[
 meshMeshRegion[mesh,
  MeshCellLabel ->
  Map[
   i \[Function] ({2, i} -> Tooltip[i,
      Tooltip[i, Row[Grid[{"area 
 = "       {"vertices", polygons[[i]]},
         {"area", areas[[i]]}]],
         {"circumference", circumferences[[i]]}
         }]
       ]
     ),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]

Towards the areas: You can obtain them, e.g., like this

areas = With[{x = MeshCoordinates[mesh]},
  0.5 Map[
   p \[Function] Total[Det /@ Partition[x[[p]], 2, 1, 1]],
   Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]]
   ]
  ]

or like this

areas = PropertyValue[{mesh, 2}, MeshCellMeasure]

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[
 mesh,
  MeshCellLabel ->
  Map[
   i \[Function] ({2, i} -> 
      Tooltip[i, Row[{"area = ", areas[[i]]}]]),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
polygons = Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]];
polygondata = With[{x = MeshCoordinates[mesh]}, Map[
    p \[Function] Partition[x[[p]], 2, 1, 1],
    polygons
    ]];
areas = 0.5 Total[Map[Det, polygondata, {2}], {2}];
circumferences = Total[Map[Norm, Differences /@ polygondata, {2}], {2}];

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[mesh, MeshCellLabel -> Map[
   i \[Function] ({2, i} -> Tooltip[i,
       Grid[{ 
         {"vertices", polygons[[i]]},
         {"area", areas[[i]]},
         {"circumference", circumferences[[i]]}
         }]
       ]
     ),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
added 342 characters in body
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323

Towards the areas: You can obtain them, e.g., like this

areas = With[{x = MeshCoordinates[mesh]},
 0.5 Map[
   p \[Function] Total[Det /@ Partition[x[[p]], 2, 1, 1]],
   Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]]
   ]
 ]

or like this

areas = PropertyValue[{mesh, 2}, MeshCellMeasure]

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[
 mesh,
 MeshCellLabel ->
  Map[
   i \[Function] ({2, i} -> 
      Tooltip[i, Row[{"area = ", areas[[i]]}]]),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]

Towards the areas: You can obtain them, e.g., like this

With[{x = MeshCoordinates[mesh]},
 0.5 Map[
   p \[Function] Total[Det /@ Partition[x[[p]], 2, 1, 1]],
   Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]]
   ]
 ]

or like this

PropertyValue[{mesh, 2}, MeshCellMeasure]

Towards the areas: You can obtain them, e.g., like this

areas = With[{x = MeshCoordinates[mesh]},
 0.5 Map[
   p \[Function] Total[Det /@ Partition[x[[p]], 2, 1, 1]],
   Join @@ MeshCells[mesh, 2, "Multicells" -> True][[All, 1]]
   ]
 ]

or like this

areas = PropertyValue[{mesh, 2}, MeshCellMeasure]

For the tooltipping, you can also use the option MeshCellLabel of MeshRegion, but that's are a bit unwieldy:

MeshRegion[
 mesh,
 MeshCellLabel ->
  Map[
   i \[Function] ({2, i} -> 
      Tooltip[i, Row[{"area = ", areas[[i]]}]]),
   Range[MeshCellCount[mesh, 2]]
   ]
 ]
Source Link
Henrik Schumacher
  • 109.5k
  • 7
  • 186
  • 323
Loading