1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
point p(0,0,0);
point d(0.5f, 0.5f, 0.5f);
point v1(5.0f, 0.0f, 0.0f);
point v2(0.0f, 5.0f, 0.0f);
point v3(0.0f, 0.0f, 5.0f);
point v4(-5.0f, 0.0f, 0.0f);
point v5(0.0f, -5.0f, 0.0f);
point v6(0.0f, 0.0f, -5.0f);
if (rayIntersectsTriangle(p, d, v1, v2, v3)
{
std::cout << "Ray intersects triangle 1" << std::endl;
}
if (rayIntersectsTriangle(p, d, v4, v5, v6)
{
std::cout << "Ray intersects triangle 2" << std::endl;
}
|