Commit f525df46 authored by Emeric Verschuur's avatar Emeric Verschuur
Browse files

ajout de la méthode virtual bool getIntersection(const LrRay &ray, LrHit *hit,...

ajout de la méthode virtual bool getIntersection(const LrRay &ray, LrHit *hit, int fragment, Real minBound, Real maxBound) const;
parent 779ec2c6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -62,3 +62,9 @@ LrMatrix LrEntity::getMat() const
{
     return m_mat;
}

bool LrEntity::getIntersection(const LrRay &ray, LrHit *hit, int fragment,
                                         Real minBound, Real maxBound) const
{
    return false;
}
+18 −0
Original line number Diff line number Diff line
@@ -114,6 +114,24 @@ public:
    virtual bool getIntersection(const LrRay &ray, LrHit *hit,
                                 Real minBound=0, Real maxBound=INFINITY) const=0;
    
    /**
     * @brief Donne d'intersection entre un rayon et un fragment de la géométrie.
     * @param ray Référence d'un objet LrRay.
     * @param hit Adresse de l'objet LrHit dans lequel sera stocké le résultat.
     * @param fragment Fragment de la géométrie.
     * @param minBound Distance minimum par rapport à l'origine (défaut : 0).
     * @param maxBound Distance maximum par rapport à l'origine (défaut : INFINITY).
     * @return vrai si il y a une intersection, sinon faux.
     *
     * Cette méthode calcul l'intersection entre le rayon @a ray et le fragment 
     * @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée 
     * par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier 
     * la portion du rayon, à l'aide des paramètres @a minBound @a maxBound , 
     * à prendre en compte pour ce calcul.
     */
    virtual bool getIntersection(const LrRay &ray, LrHit *hit, int fragment,
                                 Real minBound, Real maxBound) const;
    
    /**
     * @brief Donne le nombre de fragments de l'entitée.
     * @return Un entier.
+18 −0
Original line number Diff line number Diff line
@@ -91,6 +91,24 @@ bool LrEntityElementary::getIntersection(const LrRay &ray, LrHit *hit,
    }
}

bool LrEntityElementary::getIntersection(const LrRay &ray, LrHit *hit, int fragment,
                                         Real minBound, Real maxBound) const
{
    if (m_geometry->getIntersection(ray,hit,fragment,m_transf,m_transfInv,m_transfInvTransp,minBound,maxBound))
    {
        if (hit!=NULL)
        {
            hit->entity=(LrEntity*)this;
            hit->optic=m_optic;
        }
        return true;
    }
    else
    {
        return false;
    }
}

void LrEntityElementary::getMinMax(LrPoint &min, LrPoint &max) const
{
    m_geometry->getMinMax(min,max,m_transf);
+18 −0
Original line number Diff line number Diff line
@@ -90,6 +90,24 @@ public:
    virtual bool getIntersection(const LrRay &ray, LrHit *hit,
                                 Real minBound=0, Real maxBound=INFINITY) const;
    
    /**
     * @brief Donne d'intersection entre un rayon et un fragment de la géométrie.
     * @param ray Référence d'un objet LrRay.
     * @param hit Adresse de l'objet LrHit dans lequel sera stocké le résultat.
     * @param fragment Fragment de la géométrie.
     * @param minBound Distance minimum par rapport à l'origine (défaut : 0).
     * @param maxBound Distance maximum par rapport à l'origine (défaut : INFINITY).
     * @return vrai si il y a une intersection, sinon faux.
     *
     * Cette méthode calcul l'intersection entre le rayon @a ray et le fragment 
     * @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée 
     * par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier 
     * la portion du rayon, à l'aide des paramètres @a minBound @a maxBound , 
     * à prendre en compte pour ce calcul.
     */
    virtual bool getIntersection(const LrRay &ray, LrHit *hit, int fragment,
                                 Real minBound, Real maxBound) const;
    
    /**
     * @brief Donne le nombre de fragments de l'entitée.
     * @return Un entier.