Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago