MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Parsing polygon lists


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 


  • Prev by Date: strange messsages when starting MMa
  • Next by Date: Re: TraceInternal and OptionQ
  • Previous by thread: Re: Parsing polygon lists
  • Next by thread: Limit[ E^(a x), x->-Infinity]