Erdal Karaca
2012-Jul-19 10:00 UTC
[R] [deldir] map original index of coords to describe triangles
My data:> head(cbind(x,y,z))x y z [1,] -78.1444 -60.4424 -10.09 [2,] -78.1444 -58.4424 -10.26 [3,] -78.1444 -56.4424 -10.45 [4,] -78.1444 -54.4424 -10.64 [5,] -76.1444 -60.4424 -10.19 [6,] -76.1444 -58.4424 -10.34> tris <- deldir(x, y) > triangs <- triang.list(tris)> head(tris$delsgs)x1 y1 x2 y2 ind1 ind2 1 -78.1444 -58.4424 -78.1444 -60.4424 2 1 2 -78.1444 -56.4424 -78.1444 -58.4424 3 2 3 -78.1444 -54.4424 -78.1444 -56.4424 4 3 4 -76.1444 -60.4424 -78.1444 -60.4424 5 1 5 -76.1444 -60.4424 -78.1444 -58.4424 5 2 6 -76.1444 -58.4424 -78.1444 -58.4424 6 2> head(triangs)[[1]] x y 1 -78.1444 -60.4424 2 -76.1444 -60.4424 3 -78.1444 -58.4424 [[2]] x y 1 -78.1444 -60.4424 2 -70.1444 -62.4424 3 -76.1444 -60.4424 [[3]] x y 1 -78.1444 -60.4424 2 -64.1444 -64.4424 3 -70.1444 -62.4424 [[4]] x y 1 -78.1444 -60.4424 2 -58.1444 -66.4424 3 -64.1444 -64.4424 [[5]] x y 1 -78.1444 -60.4424 2 -52.1444 -68.4424 3 -58.1444 -66.4424 [[6]] x y 1 -78.1444 -60.4424 2 -24.1444 -78.4424 3 -52.1444 -68.4424 Question: How do I get a list of the positions of the coords in triangs instead of the real coords? I.e., instead of the real coords provided to deldir() I would need the positions of the coords which form a triangle: x y 1 -78.1444 -60.4424 2 -76.1444 -60.4424 3 -78.1444 -58.4424 Triangle: coord1 coord2 coord3 Thanks! [[alternative HTML version deleted]]