je me suis inspiré de ta fonction intersectLinePlane pour chercher l'intersection avec une face d'un solide. Je me suis rendu compte que tu n'utilisais pas les fonctions vectorielles fournies par App.Vector, y a t'il une raison ?
Pour info voila ma fonction :
Code: Select all
def intersecLineFace(A,B, face):
""" Return the intersection between the Line (A,B) and the face. """
if (None in [A,B,face]) :
return None
if (str(face.Surface) == "<Plane object>") :
N = face.normalAt(0,0)
p1 = face.CenterOfMass
d = -(N.dot(p1))
U = B-A
if U.dot(N) == 0.0:
# if A belongs to P : the full Line L is included in the Plane
if N.dot(A) + d == 0.0:
return A
# if not: the Plane and line are paralell without intersection
else:
return None
else:
k = - (N.dot(A) + d) / (N.dot(U) )
T = A + U*k
return T
else :
#TODO : non plane case
return None