Example #1
0
 bool BoundingEllipsoid::intersects (math::Ray &r, bool segment, CollisionResultSet::Info& info) {
     math::Matrix4f transform = scale * rotation * translation;
     math::Matrix4f invTransform = transform.inverse();
     math::Vec3f orig = invTransform * r.getOrig();
     math::Vec3f ext = invTransform * r.getExt();
     math::Ray tRay (orig, ext);
     math::Vec3f mtu;
     BoundingSphere bs(math::Vec3f(0, 0, 0), 1);
     if (!bs.intersects(tRay, segment, info))
         return false;
     return false;
 }
Example #2
0
 bool BoundingEllipsoid::intersectsWhere(math::Ray& r, math::Vec3f& near, math::Vec3f& far, CollisionResultSet::Info& info) {
     math::Matrix4f transform = scale * rotation * translation;
     math::Matrix4f invTransform = transform.inverse();
     math::Vec3f orig = invTransform * r.getOrig();
     math::Vec3f ext = invTransform * r.getExt();
     math::Ray tRay (orig, ext);
     math::Vec3f i1, i2;
     BoundingSphere bs(math::Vec3f(0, 0, 0), 1);
     if (!bs.intersectsWhere(tRay, i1, i2, info))
         return false;
     near = transform * i1;
     far = transform * i2;
     return true;
 }