Question: (2). [5 points] Write an intersection predicate, RayLineIntersectProp, in C (or Java or pseudocode) which takes four points, a, b, c, d, which define a
![(2). [5 points] Write an intersection predicate, RayLineIntersectProp, in C (or](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e9b4a9c6c_10866f3e9b429320.jpg)
(2). [5 points] Write an intersection predicate, RayLineIntersectProp, in C (or Java or pseudocode) which takes four points, a, b, c, d, which define a ray, ab (with endpoint a and passing through point b a, going to infinity) and a line. cd, through points c and d c, and determines if they intersect properly or not. (The ray ab is considered to be closed it includes its endpoint a.) Here, intersection will mean that they have a proper intersection: there is eractly one point of the interior of ray ab that also lies on the line ed. (We do not consider them to intersect properly if they share exactly the endpoint a. We also do not consider them to intersect properly if they are collinear, since there intersection would then be the entire ray, rather than a single point.) You are allowed to assume that a b and that c* d Your predicate should start bool RayLineIntersectProp( tPointi a, tPointi b, tPointi c, tPointi d) [FILL IN HERE] You may use the predicates Area2, Left, LeftOn, Collinear, IntersectProp, Between, and Intersect from the text, but try to think carefully about making your code complete (handling all cases) and efficient (avoiding duplication of tests) You may find it helpful also to use the following predicate, CrossProduct /* Compute the cross product of vector ab and vector cd/ int CrossProduct( tPointi a, tPointi b, tPointi c, tPointi d ) returrn Note: Even if you have never programmed in C before, this exercise should be within your ability; try to read and understand the code fragments of section 1.5. If you are comfortable with C programming, you may find it convenient to test it by compiling it and executing the code (within a simple main program)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
