[Edu-sig] Basic dictionary question

Kirby Urner urnerk at qwest.net
Mon Oct 10 21:28:08 CEST 2005


> I'll post again when I have more research behind me and either a solution
> or concrete frustration in sight -- not before.
> 
> Kirby

OK, I've got a solution working.  Here's an interim result:
http://www.4dsolutions.net/satacad/pythonicmath/connectorstudy2.jpg

Notice how the zigzag metal bands connect jade icosahedra and don't clutter
the unit cell otherwise, i.e. no extra tabs that don't go through bridge
points.

I ended up using a feature specific to my vector class:  the bridge points
all had 4-tuple signatures with floats = multiples of 1/2.  So I used a
little round and chop function that appears to have worked:

    @staticmethod
    def _mktuple(qray):
            thecoords = qray.coords
            thelist = []
            for c in thecoords:
                t = float(str(round(c,5))[:4])
                thelist.append(t)
            return tuple(thelist)

The 4-tuples are all positive, even in xyz octants w/ negatives, thanks to
quadray vector algebra.  I stuffed 'em into a dict like this:

def add2pairs(adict, thekeys):
    for newkey in thekeys:
        adict[newkey] = adict.get(newkey,0) + 1
    return addict

...then permitted only those with value = 2 to render.

Special thanks to Guido and Scott for helping me grabble with this issue.

Kirby

Note:

Here's the stuff photographed in time/size (vs. rendered):
http://www.4dsolutions.net/satacad/pythonicmath/lanahan_artifact.jpg
(photo by Dave Ulmer @ Linus Pauling House, wwwanderers.org)




More information about the Edu-sig mailing list