On Mar 22, 2007, at 8:53 PM, Charless Fowlkes wrote:


both these files seem to have the same problem with
misoriented faces.  i found the option to turn on and
off backface culling in mayavi.

1. select the "surfacemap" module click on "configure"
2. in the configure window, select show pipeline, expand
   the tree and doubleclick actor-property
3. turn on frontface culling and "apply"

Followed your instructions and I get the same problem.


maybe you can try this and see if it reveals the mis-oriented
faces in your viewer?

Yup.

you can also see the problem by visualizing the components
of the cellNormals in paraview.

I checked the face normals in fipy and they seem fine. I've pasted the code I used to do this below. If I am right (fipy has no problem), then this is a display issue to do with fipy talking to mayavi (mayavi knows nothing about oriented face normals, it uses vertex ordering to determine normals). If we can solve this by flipping a switch in mayavi then I think that is a good solution. We may not be using mayavi (if matplotlib has a 3D capability) in the future so fixing this may not be a good investment of time. Anyhow, here is the code I used to check the face normals. It seems to give the answer I expect in that it returns True and True maning that the exterior faces are pointing out and the interior faces are pointing in. Cheers



 ## start
from fipy import *

def dilate(x):
    return x * 1.1

import extrude
mesh = extrude.Extruded3DGmshImporter('sphere.msh', dilate)

rmin = 5.0
rmax = 5.5

epsilon = 0.1
normals = mesh._getOrientedFaceNormals()
fc = mesh.getFaceCenters()
r = numerix.sqrt(numerix.sum(fc**2, axis=1))
print 'numerix.min(r)',numerix.min(r)
print 'numerix.max(r)',numerix.max(r)

exteriorFaceIDs = numerix.nonzero(r > (rmax - epsilon))
exteriorNormals = numerix.take(normals, exteriorFaceIDs)
exteriorCenters = numerix.take(fc, exteriorFaceIDs)

print len(exteriorFaceIDs)
print len(exteriorNormals)

interiorFaceIDs = numerix.nonzero(r < (rmin + epsilon))
interiorNormals = numerix.take(normals, interiorFaceIDs)
interiorCenters = numerix.take(fc, interiorFaceIDs)

print len(interiorFaceIDs)
print len(interiorNormals)

isPointingOut = numerix.sqrt(numerix.sum((exteriorCenters + exteriorNormals)**2, axis=1)) > rmax isPointingIn = numerix.sqrt(numerix.sum((interiorCenters + interiorNormals)**2, axis=1)) < rmin
print numerix.alltrue(isPointingOut)
print numerix.alltrue(isPointingIn)
##end



--
Daniel Wheeler


Reply via email to