12
$\begingroup$

This is an offspring of answering another question.


Consider

data = {{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1},
        {9.5, 14.9}, {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5},
        {3.3, 7.7}, {0.6, 5.1}, {5.3, 2.4}, {8.45, 4.7},
        {11.5, 9.6}, {13.8, 7.3}, {12.9, 3.1}, {11, 1.1}};

vor = VoronoiMesh[data];

All indices of the interior faces can be obtained with

i2 = MeshCellIndex[vor, {2, "Interior"}] (* undocumented *)

thence

HighlightMesh[vor, Style[i2, Red]]

enter image description here

It works also for points (0) and lines (1):

i0 = MeshCellIndex[vor, {0, "Interior"}]
i1 = MeshCellIndex[vor, {1, "Interior"}]

enter image description here

I found (by trial-and-error) that there's also "Boundary":

b0 = MeshCellIndex[vor, {0, "Boundary"}]
b1 = MeshCellIndex[vor, {1, "Boundary"}]

giving

enter image description here

Unfortunately,

MeshCellIndex[vor, {2, "Boundary"}]

{}

doesn't work.

Questions:

  1. Is there something similar to "Interior" for the bordering faces (i.e., the missing MeshCellIndex[vor, {2, "Boundary"}] output)? They can be obtained with Complement[MeshCellIndex[vor, 2], i2], but it looks too cumbersome compared to the "Interior" simplicity.
  2. Regarding the lines (1), "Interior" and "Boundary" don't give all of them (i.e., the ones leading from the interior to the boundary); the remaining can be obtained with Complement[MeshCellIndex[vor, 1], b1, i1], but again it would be nice to have a one-word description.
$\endgroup$

1 Answer 1

12
$\begingroup$

Found by trial-and-error that MeshCellIndex[vor,{2,"Frontier"}] gives what you are looking for:

HighlightMesh[vor, Style[ MeshCellIndex[vor,{2,"Frontier"}], Red]]

or

MeshRegion[vor,  MeshCellStyle -> ({2,"Frontier"}->Red)]

Mathematica graphics

To get the lines leading from the interior to the boundary you can simply replace 2 above with 1. For example,

MeshRegion[vor,  MeshCellStyle -> ({1,"Frontier"}->Red}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ How to find those all undocument string? $\endgroup$
    – yode
    Aug 29, 2017 at 1:25
  • 1
    $\begingroup$ @yode, just tried some of the properties returned by vor["Properties"]. $\endgroup$
    – kglr
    Sep 7, 2017 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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