30 const Ogre::Vector2 &c,
const Ogre::Vector2 &d)
32 float r, s, denominator = (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x);
37 return Ogre::Vector2::ZERO;
40 float numeratorR = (a.y - c.y) * (d.x - c.x) - (a.x - c.x) * (d.y - c.y);
45 r = numeratorR / denominator;
47 float numeratorS = (a.y - c.y) * (b.x - a.x) - (a.x - c.x) * (b.y - a.y);
49 s = numeratorS / denominator;
53 if (r < 0 || r > 1 || s < 0 || s > 1)
55 return Ogre::Vector2::ZERO;
71 return Ogre::Vector2((a.x + (r * (b.x - a.x))),
72 (a.y + (r * (b.y - a.y))));