To second Bert Gunter: you may get better answers if you give us a complete description.
On Thu, Jul 5, 2012 at 12:37 PM, Thomas C. <thomas.csa...@gmail.com> wrote: > i have number of triangles which i'd like to store in a list, > matrix,...etc. > i thought it could look sth. like that: > > triangle node1 node2 node3 ..... > 1 c(x1,y1) c(x2,y3) c(x3,y3) > 1 c(x4,y4) c(x5,y5) c(x6,y6) > You already indicate that that's not the whole truth, but if it was you could consider one of two approaches: * Rather than a 2D array (also called "matrix") use a 3D array, with dimensions n.triangle x 3 x 2. * You could use a n.triangle x 3 matrix of complex numbers. That may look like a sneaky trick to put a vector into a matrix element, but some operations of planar geometry can written elegantly. E.g., distance between a and b is abs(a-b). It all depends on what you want to do. BTW, what do you consider a neighbor of a triangle? * * If you are working with a triangle mesh, it might be better to hold the vertices in a double matrix (n.vertex x 2) and represent the triangles as indices into it, i.e., as an integer matrix (n.triangle x 3). You may use more columns in either matrix to represent more attributes. If you find out you need columns of different types, consider a data frame. /Christian [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.