Well i consider the triangle to be an infinite plane if you need to know if a point is contained inside the triangle, jus ask.
If denum is zero ( it woul be more nice to check for an absolute epsilon , but i found that this worked as well )then the triangle normal and the ray are orthogonal and thus they don't intersect, this condition is never met since i put an epsilon rsulting in a very distant intersection point, then another function checks for the point to be contained inside the triangel itslef.
Your assumptions about the vectors are correct expcet for P0 , it is the origin of the plane where the triangle is inscribed, so
A and B start and end point of ray ( note that this is an infinite ray ) , P0
first point of the triangle and N is its normal.
Since i use this function as an ancillary function, you should do like this if you wnat to improve
check if 0 \< t \< 1 , in this way you know if the point lies on the ray,
if this check is valid, check for the point ot be contained inside the triangle