1
$\begingroup$

This question already has an answer here:

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$

marked as duplicate by Kuba, user9660, Yves Klett, Oleksandr R., m_goldberg Jan 18 '16 at 15:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Your code gives me a green triangle. Win10 V10.3.1 $\endgroup$ – Kuba Jan 16 '16 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$ – Lyle Ramshaw Jan 16 '16 at 20:47
  • $\begingroup$ Most probably, can't test that, don't have 10.0 :/ $\endgroup$ – Kuba Jan 17 '16 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$ – Lyle Ramshaw Jan 18 '16 at 3:53
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.