3d camera hdu2693
时间: 2023-09-18 16:11:00 浏览: 130
camera3d
题目描述
You are given a 3D rectangular box. You are also given the location of a 3D camera, which is looking down onto the box. The camera can only view the box in 2D. More specifically, the camera can only see the projection of the box onto a 2D plane. The 2D plane is perpendicular to one of the sides of the box.
Your task is to write a program that calculates the area of the projection of the box that the camera can see.
输入
The input file contains several test cases. Each test case is described by a single line containing six integers x1, y1, z1, x2, y2, z2. The coordinates (x1, y1, z1) and (x2, y2, z2) represent the opposite corners of the box. The input is terminated by a line containing six zeros.
输出
For each test case, output a line containing a single integer, the area of the projection of the box that the camera can see. The area should be rounded down to the nearest integer.
样例输入
0 0 0 1 1 1
0 0 0 10 10 10
0 0 0 0 0 0
样例输出
1
100
0
提示
题意: 给你一个矩形,有一摄像机在某个方向上拍摄这个矩形,求这个矩形在摄像机视野里的投影面积。
思路: 暴力模拟。
对于任意一个矩形,投影面积必定等于矩形的最大面积。
分别枚举三个方向上的投影面积,取最大值输出即可。
注意: 要开 long long。
AC Code:
阅读全文