1
$\begingroup$

If I say

tri = ConvexHullMesh[{{0, 1}, {1, 1}, {1, 0}}]

a triangle is rendered in blue. How can I change that color? An answer to an earlier question suggested passing tri, which is actually a BoundaryMeshRegion, to HighlightMesh, like this:

hm = HighlightMesh[tri, {Style[0, PointSize[0.05], Red], 
                         Style[1, Thick, Black],
                         Style[2, Green]}]

That does indeed highlight the vertices as red dots and the edges as black lines; but the triangle is still blue. The Properties list in InputForm[hm] sets the MeshCellStyle of the 2-dimensional cells to green. But perhaps HighlightMesh is not prepared to highlight the top-dimensional face?

Maybe I should be using some different approach?

$\endgroup$
4
  • $\begingroup$ Your code gives me a green triangle. Win10 V10.3.1 $\endgroup$
    – Kuba
    Commented Jan 16, 2016 at 19:24
  • $\begingroup$ Aha. My blue triangle comes from Version 10.0.2.0. So maybe this was a bug that has been fixed? $\endgroup$ Commented Jan 16, 2016 at 20:47
  • $\begingroup$ Most probably, can't test that, don't have 10.0 :/ $\endgroup$
    – Kuba
    Commented Jan 17, 2016 at 8:52
  • 3
    $\begingroup$ This was a bug introduced in 10.0 and fixed in 10.2. For people still running 10.0, an easy fix is described in a Stack Exchange posting from 2014 that you can find by searching for "ConvexHullMesh Bug 2D".. $\endgroup$ Commented Jan 18, 2016 at 3:53

1 Answer 1

3
$\begingroup$

Perhaps this example could be helpful:

pts = RandomReal[1, {10, 2}];
ch = VoronoiMesh[pts]; mp = MeshPrimitives[ch, 2];
ml = MeshPrimitives[ch, 1];
mpt = MeshPrimitives[ch, 0];
Graphics[Riffle[RandomColor[Length@mp], mp]~Join~{Red, Thick, ##} & @@
     ml~Join~{Blue, PointSize[0.02], ##} & @@ mpt]

enter image description here

$\endgroup$

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