Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Parsing polygon lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8963] Parsing polygon lists
  • From: Russell Towle <rustybel at foothill.net>
  • Date: Mon, 6 Oct 1997 01:59:32 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all,

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.

My current method is as follows, using a function "facent" which finds the
centers of polygons:

1. Find the centers of each polygon in the list 'a':
centfaces = Map[ facent[#]&,  a];(*no problem here*)

2. Find the positions in the list of face centers wherein one face center
equals another:
qaz = Table[ Position[ centfaces, x_ /; x==centfaces[[i]] ], {i, Length[ a
]} ];(*slow*)

3. Drop the duplicate pairs:
red = Flatten[ DeleteCases[ qaz, x_ /; Length[ x ]==2] ];(*OK as is*)

After step (3), I can construct a new list of polygons by writing a[[red]].

The main problem is step (2), which is terribly slow. At times the number
of polygons may exceed three or four thousand or more. I am using version
2.2.2.

Russell Towle
Giant Gap Press:  books on California history, digital topographic maps
P.O. Box 141
Dutch Flat, California 95714
------------------------------
Voice:  (916) 389-2872
e-mail:  rustybel at foothill.net
------------------------------




  • Prev by Date: Re: NIntegrate where terms of integrand have unknown constant coefficients
  • Next by Date: Limit[ E^(a x), x->-Infinity]
  • Previous by thread: Re: Setting precision in binary digits?
  • Next by thread: Re: Parsing polygon lists