Re: Parsing polygon lists
- To: mathgroup at smc.vnet.net
- Subject: [mg8980] Re: Parsing polygon lists
- From: "Xah" <xah at best.com>
- Date: Tue, 7 Oct 1997 03:35:27 -0400
- Organization: smtp.best.com
- Sender: owner-wri-mathgroup at wolfram.com
In article <61713u$orl at smc.vnet.net>, Russell Towle <rustybel at foothill.net>
wrote:
>I wish to optimize the task of, given a large list of polygons in 3-space,
>some of which may fall into coincidence in pairs, to delete any such pairs
>from the list. The polygons are lists of vertices, and each vertex is a
>list of three real numbers.
>...
Hi Russell,
Assuming that your list of polygons is flat. Improving upon your solution,
the following one should be faster. Suppose PolygonCentroid[Polygon[...]]
returns the centroid of a polygon.
(*this attaches the centroid as head to each polygon*)
polygonList /. poly_Polygon:>(PolygonCentroid at poly)@poly
Then you can use several techniques that remove duplicates. Something like
Union[{5[7],2[m],a[4],5[6]},SameTest->(Head at #1===Head@#2&)]
Xah
xah at best.com
http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
Mountain View, CA, USA