Question: 2. Consider a ray with endpoint e and (unitary) direction u. Consider a plane with (unitary) normal vector n and with a point x0 located

 2. Consider a ray with endpoint e and (unitary) direction u.

2. Consider a ray with endpoint e and (unitary) direction u. Consider a plane with (unitary) normal vector n and with a point x0 located anywhere on the plane. The equations for the ray and the plane are: ray: R(t)-e ut plane: P(x)- x-x0)n-0 Any point r on the ray can be found using the real value t-. Any point x that satisfies the plane equation is on the plane. e) Write a code in C++that receives e, u,n and x0, and returns true if the ray intersects the plane. Assume all vectors have the same size. // you can use vec f as a shortcut for a vector of floats typedef vectorcfloat> vec f bool intersects (vecf se,vecf su, vecf in, vec 6xo) /I computes dot product between the vectors a and b float dot (vecf a, vecf 6b) { - - float d- 0; return d: // compute the difference between vectors a and b vec t sub (vec_f sa, vec f b) vec t result(a.size) return result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!