Timeline for Visibility Graph of Polygon
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 27, 2016 at 15:26 | comment | added | yode |
adjmat = Map[Boole[Region`RegionSubset[#, Polygon[pts]]] &, lines, {2}] - IdentityMatrix[Length[pts]];
|
|
May 27, 2016 at 13:47 | comment | added | Michael Seifert |
@HarshaTirumala: I had no idea that GraphPlot accepted adjacency matrices to construct graphs, so thanks for the tip! Now that I have a copy of MM to play with, I found a way to do it with AdjacencyGraph as well; see my edited answer.
|
|
May 27, 2016 at 13:45 | history | edited | Michael Seifert | CC BY-SA 3.0 |
added 478 characters in body
|
May 27, 2016 at 4:42 | comment | added | Harsha Tirumala |
AdjacencyGraph doesn't have VertexCoordinateRules as an option. But graphplot does; so this piece of code did work : GraphPlot[adjmat, VertexCoordinateRules -> pts] . Thanks for your effort.
|
|
May 27, 2016 at 1:37 | comment | added | Michael Seifert |
@HarshaTirumala: I don't have a version of Mathematica here at home, but I think if you replace the last command with AdjacencyGraph[adjmat, VertexLabels -> "Index", VertexCoordinateRules -> pts] you'll get a graph with the points laid out at their "true" locations. Alternately, you could use Select to pick out the interior lines out of lines and use Graphics to render them. If I have time tomorrow, I'll update this answer.
|
|
May 26, 2016 at 20:31 | comment | added | Harsha Tirumala | Thank you. optimisation is not an issue as i only want the end result. even my Mac took around 30 seconds. Can the matrix be drawn on the polygon skeleton? im new to mathematica so not sure of how to proceed with it although i believe it would be possible. | |
May 26, 2016 at 20:29 | vote | accept | Harsha Tirumala | ||
May 26, 2016 at 20:13 | history | answered | Michael Seifert | CC BY-SA 3.0 |