3
$\begingroup$

Actually we can get some information in here.But I'm confuse this phenomenon still:

test = ConvexHullMesh[RandomReal[1, {7, 2}]]

Mathematica graphics

test["EdgeLengths"]

{0.192337,0.4887,0.176702,0.185319,0.564806,0.428493,0.805059}

But the same result will not appear this case,

region = BoundaryMesh[DiscretizeRegion[SSSTriangle[3, 4, 5]]]

Mathematica graphics

region /@ {"AdjacencyMatrix", "EdgeLengths"}

Mathematica graphics

I think if the properties of "EdgeLengths" can work normally,it will help a lot to Labeling triangle edges in Mathematica 10.

Note this,please. these region have a same head.

Head /@ {test, region}

{BoundaryMeshRegion, BoundaryMeshRegion}

$\endgroup$
2
$\begingroup$

I think what you are using is an undocumented feature in these region objects, so I wouldn't expect it to work properly.

You can see some of the properties by using:

region["Properties"]

The list is quite long so I won't be including it here. Now, both of your regions will show "EdgeLengths" as one of the properties, so you clearly see that this undocumented feature is not completely fleshed-out. What's documented though, is the PropertyValue approach (well, partly at least), so let's use it:

PropertyValue[{test, 1}, MeshCellMeasure]
(* {0.261146, 0.694517, 0.406227, 0.339956, 0.576842} *)

PropertyValue[{region, 1}, MeshCellMeasure] (* This gives the length of the sides *)
(* {5., 3., 4.} *)

The 1 means we want the 1-D measure, which is the length of the edges. If you want the area, use 2, etc. One should be able to use PropertyList to obtain possible properties of a region, but this doesn't always work. Even in the "possible issues" section of the documentation for PropertyValue (which only shows example of its use with Graphs), it says:

PropertyValue may return $Failed even when a property value exists:

Then shows an example where this happens. Clearly, even this approach is a work in progress.

Update

On the other hand if you still want to access the undocumented "Properties" of the regions, you can still use the also undocumented approach by calling Graphics`Region`ToMeshObject on the mesh objects e,g.

treg = Graphics`Region`ToMeshObject[region];

Then you can now call "EdgeLengths" and other properties:

treg /@ {"AdjacencyMatrix", "EdgeLengths"}

(* {{{0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {5., 3., 4.}} *)
$\endgroup$
  • $\begingroup$ Grateful for your patient explanation.:) $\endgroup$ – yode Apr 17 '16 at 15:55
  • $\begingroup$ @yode. You're welcome. We're all confused about some of the region functions. $\endgroup$ – RunnyKine Apr 17 '16 at 15:59
  • $\begingroup$ I just guess such as Graphics`Region`ToMeshObject maybe give a help,but I don't sure. I remain it open for some time. $\endgroup$ – yode Apr 22 '16 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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