Thank you for your answer Alok,
After much rereading and viewing other script on the internet I saw my 
error ... you have to replace the * by / for each "edge" ...

I have only one condition that tells me whether I have an intersection or 
not. In this case I return None. The script that will call this function 
will have to make the verification namely: If it's none I do what? This is 
not None so I have the min, max values ​​of my intersection

def box_aabb_intersect(self, m_bbox):

        """
        !@Brief Check if ray intersect boundingBox.

        @type m_bbox: OpenMaya.MBoundingBox
        @param m_bbox: BoundingBox you want to check

        @rtype: float
        @return: Distance of ray origin and intersect point.
        """

        t1 = (m_bbox.min().x - self.__v_origin.x) / self.__v_direction.x
        t2 = (m_bbox.max().x - self.__v_origin.x) / self.__v_direction.x
        t3 = (m_bbox.min().y - self.__v_origin.y) / self.__v_direction.y
        t4 = (m_bbox.max().y - self.__v_origin.y) / self.__v_direction.y
        t5 = (m_bbox.min().z - self.__v_origin.z) / self.__v_direction.z
        t6 = (m_bbox.max().z - self.__v_origin.z) / self.__v_direction.z

        t_min = max(max(min(t1, t2), min(t3, t4)), min(t5, t6))
        t_max = min(min(max(t1, t2), max(t3, t4)), max(t5, t6))

        #   if tmax < 0, ray (line) is intersecting AABB, but the whole 
AABB is behind us
        #   if tmin > tmax, ray doesn't intersect AABB
        if t_max < 0.0 or t_min > t_max:
            return

        return t_min, t_max


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/91e425ff-e687-41a0-a5f7-8e3a449aabeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to