[Edu-sig] Basic dictionary question
Kirby Urner
urnerk at qwest.net
Sun Oct 9 07:54:39 CEST 2005
Talk about fishing for expert help!
Thanks Guido.
It's a pruning algorithm where I strip way pieces that don't meet up at
(x,y,z) bridge points. Lots of symmetry about the origin so just pure
distance won't work (not unique enough).
I think might still get away with a tuple-indexed dict (tallying for pairs,
pruning the rest) if I boil my floating points down to fixed decimals -- a
chance to play with the new decimal type perhaps.
I appreciate the quick lecture on intransitive nature of fuzzy equality and
__hash__ vs. __eq__. Helps me think.
Kirby
> You never said what you wanted to do with these points -- are you
> looking to find which points are in fact close enough to be considered
> the same point? I suppose you could sort them by the vector length
> (sqrt(x**2 + y**2 + z**2), that sort of thing) and then you only have
> to compare points that are close together in the sorted list (as long
> as the abs values are closer than your epsilon). Or you could divide
> 3-space up into cubes with sides equal epsilon, and then you'd only
> have to look for points that end up in the same or in adjacent cubes.
>
> --Guido
More information about the Edu-sig
mailing list