[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2x Mesh.c blender/source/blender/python/api2_2x/doc Mesh.py

Campbell Barton cbarton at metavr.com
Sun Dec 17 03:58:38 CET 2006


Martin Poirier wrote:
> --- Campbell Barton <cbarton at metavr.com> wrote:
>
>   
>> A the moment edges have a hash function that returns
>> the edge index,
>>
>> edge.key is the same as  (min(ed.v1.index,
>> ed.v2.index), 
>> max(ed.v1.index, ed.v2.index))
>>
>> Maybe they can be merged, any thaughts?
>>     
>
> What's wrong with using the edge index as hash that
> you had to create an artificial key instead?
>
> Martin
>   
if you want to find the edge that a face is using,
you can get the 2 verts, order the pair of indicies and use them as a 
key to get the edge.
I was doing this in quite a few scripts, and while not dificuled its 
fluff that can be better done this way.
Heres an example of how connectivity data can be done with the new values.

       edge_faces = dict([(ed.key, []) for ed in me.edges])
       for f in me.faces:
           for key in f.edge_keys:
               edge_faces[key].append(f) # add this face to the edge as 
a user



-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-committers mailing list