[Bf-python] How to get inside faces from inside verts?

lynx.abraxas at freenet.de lynx.abraxas at freenet.de
Wed May 20 21:52:27 CEST 2009


Hello!


I  figured  out  pointInside()  just  doesn't  work  on my fractally distorted
sphere. Belender seems to have trouble there getting the normaldirection right
even when recalculating them. If I just use a icosphere pointInside works.
My new problem is now:
How can I copy the faces that belong to the insiede verts?
Or how to get the inside faces directly?

Thanks
Lynx


On 20/05/09 17:37:43, lynx.abraxas at freenet.de wrote:
> Hello again!
> 
> 
> I'd  like to find all vertices of a mesh-object that lie within another closed
> mesh-object (ellipsoid)  to  calulate  an  average  normal  for  the  enclosed
> surface.
> 
> But  ellmesh.pointInside(v.co)  never  retruns  true  althogh  my  testobjects
> definatly intersect.
> 
> Is there something wrong with my code below or is pointInside() only  checking
> if a point is inside a triangle (not in a closed mesh)?
> 
> How do the boolean modifiers check this?
> 
> Thanks for any help or hints
> Lynx
> 
> 
> print "Evaluating ellipsoids now..."
> ells = [ob for ob in obs if ob.name.find('Ellipsoid') >= 0] #get ellipsoids
> for ell in ells:
>   ellmesh= ell.getData(mesh=1)
>   print ell.name
>   vin = bpy.data.meshes.new('Imesh_')          # create a new mesh
>   for v in potmesh.verts: #find all potato vertices inside this ellipsoid
>     #print v.co
>     #print len(vin.verts)
> 
>     if ellmesh.pointInside(v.co):
> 
>         vin.verts.extend(v) #append? No extend is from MVertSeq
>         print "extended vert-list by: ", v
>         #what if ell is smaller than potato trig??? Subsurf would help!
>     #print len(vin.verts)
>   if len(vin.verts):
>         print vin
>         print vin.verts
>         if len(vin.trigs) < MinTrigs:
>             print "Very few normals inside: ", len(vin.trigs)
>             print "Perhaps megabool would help here"
>             print "Just subsurfing won't help!"
>         for t in vin.trigs:
>             #calcNormals()#recalcNormals(direction=0)
>             #subdivide(beauty=0)
>             #QuadNormal(vec1, vec2, vec3, vec4)
>             #quadToTriangle(mode=0)#triangleToQuad()
>             a= B.Mathutils.TriangleArea(vec1, vec2, vec3)
>             n= B.Mathutils.TriangleNormal(vec1, vec2, vec3)
>             n.normalize() #normalize the normal
>             ns= ns + a*n  #add area weighted normal to normal sum
>         print "Normal sum of ellipsoid: ", ell, ns
> 
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list