Re: Split
- To: mathgroup at smc.vnet.net
- Subject: [mg17490] Re: Split
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Mon, 10 May 1999 01:44:27 -0400
- References: <7h4hna$ecs@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Russell Towle <rustybel at foothill.net> wrote in message news:7h4hna$ecs at smc.vnet.net... > I have a list of 3D polygons with known surface areas, say, 1000 polygons > and 15 different areas. I wish to divide the list up into sets of equal > surface area, and it seems that Split ought to be able to do this. > > How can Split be used to split the list of polygons by area? How does one > tell Split to admit a polygon into a sublist if its area is within, say, > .001 of another area? > > Thanks much for your consideration of this question! > > Russell Towle > P.O. Box 141 > Dutch Flat, California 95714 > ------------------------------ > Voice: (530) 389-2872 > e-mail: rustybel at foothill.net > ------------------------------ > Russell, Some ideas - details would depend on how the areas are attached to the polygons. List the pairs {area, polygon} aps = {{1,p}, {2,q}, {1.1,r},{2.2,s},{1.9,t},{3,t}}; Sort them according to area (putting the area first makes this easy) staps = Sort[aps] {{1,p},{1.1,r},{1.9,t},{2,q},{2.2,s},{3,t}} split when the jump in area is > .2 Split[staps,( #2[[1]]<=#1[[1]]+.2)&] {{{1,p},{1.1,r}},{{1.9,t},{2,q}},{{2.2,s}},{{3,t}}} Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565