[Bf-python] Get faces from vertex

Willian Padovani Germano wgermano at ig.com.br
Sat Apr 3 08:39:31 CEST 2004


Hey Harkyman,

Nice to see you here, you have great scripts : ).

----- Original Message -----
From: "Roland Hess" <rolandh at reed-witting.com>
To: <bf-python at blender.org>
Sent: Friday, April 02, 2004 9:04 AM
Subject: Re: [Bf-python] Get faces from vertex


> I suppose the way to approach
> this thing would be to write a function that builds an index of
> faces/verts when called. You can than have a function(s) that uses
> this index to give you the info you need. You would call the indexing
> function once per mesh. If the mesh changed, you would need to call
> it again before any more lookups were made.

Let's see -- opinions always welcome.  If our mesh is a quad divided in
two triangles:
- verts: v1, v2, v3, v4
- faces: f1 = [v1, v2, v3], f2 = [v1, v3, v4]

We can create in C an nmesh method that for the mesh above returns:
[ [f1, f2], [f1], [f1, f2], [f2] ],

which is a list like [ F(v1), F(v2), F(v3), F(v4) ],
where F(v) is a list of faces that include vertex v.

It will be faster than doing in Python, but probably only for dense
meshes the difference will be relevant.  The disadvantage, as you wrote,
is that it's necessary to call nmesh.update() first, if there were
changes.

As an nmesh method, it can be called only when / where needed, but what
about a name for it... nmesh.getVertsFaceList ?!? getFaceIndex doesn't
sound accurate to me...

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list