Hi Atom !!!
Thanks for the answer !!!
I just write this code:
import bpy
import mathutils
from mathutils import Vector
def Dist(V):
P=Vector((5,4,2))
(V - P).length
def Choice(A):
B=[]
for i in range(len(A)):
B.append(Dist(A[i]))
M=min(B)
I=B.index(M)
return I
def run():
D=[]
cu=bpy.context.object
me=bpy.data.meshes[cu.name]
N=me.faces
for i in range(len(N)):
D.append(N[i].center)
V=Choice(D)
#N[V] is the nearest face to P
a=(N[V].normal).dot((N[V].center-P))
if (a<0):
print("inside")
else:
if(a==0):
print("face")
else:
print("outside")
def Start():
run()
Now i’m not sure about the value of “a” in run function.
Thanks !!!
Edit: Hi Atom! your script seems not working in orig=mat*point… Matrix and vector are imported but …