How to find if my vector looks at the rectangle in 3D world?

159 Views Asked by At

I need to check if my vector $v=\{x, y, z\}$ looks at rectangle $r=\{A,B, C, D\}$ in 3D world where $A, B, C, D$ are some 3D points, the rectangle is planar and oriented in parallel with some axis plane always.
If it's important I don't need to find a hit point, only the fact "yes" or "not". But my math level... I know how to make it for two vectors but how to check all body of the rectangle?
I've drawn a sample where my vector looks at the rectangle:
Example
I hope it will make my question cleaner.
P.S. I'm a programmer, not a mathematician if it's possible use simple math language.

1

There are 1 best solutions below

0
On BEST ANSWER

Here’s one way of doing it:

Consider any set of three points $R,S,T$ in our three-dimensional space, which is a vector space, ’cause you said that there’s an origin. You can form the convex cone spanned by these three points. Think of it as the part of space swept out by all infinite rays from the origin that fall within (i.e. pass through) the triangle $\triangle RST$. In the language of vectors, it’s all vectors of the form $\lambda R+\mu S+\nu T$ where the coefficients $\lambda,\mu,\nu$ all are nonnegative.

To see whether a vector $V$ is in the convex cone spanned by $R,S,T$, you just use the fact that as vectors, they’re a basis of $\Bbb R^3$, and so $V$ is expressible uniquely as $V=\lambda R+\mu S+\nu T$ for some three real numbers. Are they all nonnegative? If so, yes your $V$ is in the convex cone spanned by them. Finding the numbers $\lambda,\mu,\nu$ is a standard exercise in college Linear Algebra, there are several strategies, and I won’t go into that.

In your case, you can check to see whether your $V$ is in the convex cone spanned by $A,B,C$ or the one spanned by $C,D,A$. If one of these (or both), the answer is Yes. If neither, the answer is No.