Skip to content

Commit

Permalink
fixed bug in my code
Browse files Browse the repository at this point in the history
  • Loading branch information
nobuyuki83 committed Apr 22, 2024
1 parent 7e22fe6 commit 36fc4f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions task02/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ int number_of_intersection_ray_against_edge(
auto a = area(org, org + dir, ps);
auto b = area(org, pe, org + dir);
auto c = area(org, ps, pe);
auto d = area(org + dir, ps, pe);
if (a * b > 0.f && d * c > 0.f && fabs(d) > fabs(c)) { return 1; }
auto d = area(dir+ps, ps, pe);
if (a * b > 0.f && d * c < 0.f) { return 1; }
return 0;
// the following code was a bug
//auto d = area(org + dir, ps, pe);
//if (a * b > 0.f && d * c > 0.f && fabs(d) > fabs(c)) { return 1; }
}

/***
Expand Down

0 comments on commit 36fc4f4

Please sign in to comment.