[Bf-python] FaceNormals

models at paposo.com models at paposo.com
Thu Oct 16 13:25:34 CEST 2003


Hmm. I guess you'd need to test for 4 verts...

if(mv->v[4])
    CalcNormFloat4( mf->v[0].co, mf->v[1].co, mf->v[2].co, mf->v3, fNormal)
        return newVectorObject(fNormal, 4)
else
    CalcNormFloat( mf->v[0].co, mf->v[1].co, mf->v[2].co, fNormal)
        return newVectorObject(fNormal, 3)

----- Original Message -----
From: <models at paposo.com>
To: <bf-python at blender.org>
Sent: Thursday, October 16, 2003 12:19 AM
Subject: [Bf-python] FaceNormals


> I got tired of looking at the keystuff and was looking at the forums over
at
> elysiun.  It looks like a few people were worried about accessing a face
> normal. How about this:
>
> //NMesh.c
> float fNormal[3];
>
> static PyObject *NMFace_getattr(PyObject *self, char *name)
> {
>      BPy_NMFace *mf = (BPy_NMFace *)self;
> .....
>
>  if(strcmp(name, "no") == 0)
> {
>     CalcNormFloat( mf->v[0].co, mf->v[1].co, mf->v[2].co, fNormal)
>         return newVectorObject(fNormal, 3)
>
> .....
>      return Py_FindMethod(NMFace_methods, (PyObject*)self, name);
> }
>
> //NMesh.h
> typedef struct {
> ....
>  float normal                //new
> } BPy_NMFace; /* an NMesh face */
>
> That way you could just do:
> myNormal = myFace.no
>
> I haven't tested this yet but the concept is pretty simple. You would just
> return the normal for face just like any other variable
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://www.blender.org/mailman/listinfo/bf-python
>
>




More information about the Bf-python mailing list