2602. 3D Camera

单点时限: 2.0 sec

内存限制: 256 MB

Long long ago, there was a world of triangles. A smart guy in that world invented a camera, whose viewfinder was a

triangle. The camera’s visual range could be represented by three RAYS. As the figure shows, the camera’s visual

range could be represented by three rays OA, OB, OC. Note that the visual range is INFINITE.

Now, we have a camera with known visual range and a triangle DEF in the space. The inventor wants to know if the

camera can see the triangle, in other words, if there is at least one point of the triangle strict in the visual range.

输入格式

The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases.

The first line of each test case contains 12 integers: Ox, Oy, Oz, Ax, Ay, Az, Bx, By, Bz, Cx, Cy, Cz. The second line

contains 9 integers: Dx, Dy, Dz, Ex, Ey, Ez, Fx, Fy, Fz.

All the integers in a line are separated by a whitespace.

[Technical Specification]

T is an integer, and T <= 1000.

The input guaranteed that if you look from O, three points ABC are always arranged counterclockwise.

All integers EXCEPT T is in the range of [-100,100].

We guarantee the camera and the triangle are not degenerate.

输出格式

For each test case, display a single line contains the result, “YES” for visible, “NO” for not visible.

样例

Input
2
90 -14 -17 71 98 94 69 59 -16 -52 68 13
-69 -96 43 81 -67 -79 66 -51 -53
0 0 1 0 0 0 1 0 0 0 1 0
0 0 -5 0 0 -6 1 1 -6
Output
NO
YES

0 人解决,3 人已尝试。

0 份提交通过,共有 9 份提交。

9.9 EMB 奖励。

创建: 15 年,8 月前.

修改: 7 年,2 月前.

最后提交: 1 年,6 月前.

来源: The 4th Baidu Cup Central China Invitational Programming Contest

题目标签