编程介的小学生 2019-01-14 19:26 采纳率: 20.5%
浏览 256
已采纳

C语言计算机图形学里面的光线的面积的计算的方式,采用C语言怎么一方面的实现

roblem Description
The ICPC world finals will be held in a luxurious hotel with a big ballroom. A buffet meal will be served in this ballroom, and organizers decided to decorate its walls with pictures of past champion teams.

In order to avoid criticism about favouring some of those teams over others, the organizing commitee wants to make sure that all pictures are appropiately illuminated.

The only direct way they’ve found for doing this is ensuring each picture has at least one lightbulb that directlyilluminates it.

In this way, the perimeter of the ballroom wall can be divided into illuminated parts (in whichpictures may be placed) and dark parts (which are not suitable for placing the pictures).

The ballroom has the shape of a box and contains several lightbulbs. Each lightbulb emits light in all directions, but this light can be blocked by columns. All columns in the ballroom have cylindrical shape and go from the floor to the ceiling, so light cannot pass over or above them. Columns are of course placed so that its circular section is parallel to the ballroom floor.

Any given point p on the perimeter wall is said to be illuminated if there exists a line segment (a light ray) which starts on a lightbulb, ends in p and does not touch or pass through any column.

Your task as a helper of the ICPC organization is to examine the blueprints of the ballroom and determine the total length of illuminated sections of the perimeter wall. The blueprint consist of a rectangle indicating a top view of the ballroom, with the lightbulbs and columns marked in it.

Input
Each test case will consist on several lines. The first line will contain four integers: L, the number of lightbulbs, C, the number of columns, X, the size of the ballroom on the x coordinate and Y , the size of the ballroom on the y coordinate. The lower-left corner of the ballroom is at (0, 0) while the upper-right corner is at (X, Y ).

The next L lines will contain two integers each representing the x and y coordinate of each lightbulb. The last C lines of the test case will contain three integers each, representing the x and y coordinates of the center of a column and its radius, in that order. You can assume that 1 <= L,C <= 103 and 4 <= X, Y <= 106. Also, for all pairs of coordinates (x,y), 0 < x < X and 0 < y < Y , both for lightbulbs and column center locations. All radii of the columns will be positive. Finally, no two columns will overlap, although they may touch, and no column will touch or intersect with the border of the ballroom. No lightbulb will be inside a column or in its boundary and no two lightbulbs will be in the same place.
Input is terminated with L = C = X = Y = 0.

Output
For each test case, output a single line with the total length of the illuminated parts of the perimeter wall. The result must be printed as a real number with exactly four decimal figures, with the lowest-order decimal figure rounded up.

Sample Input
2 1 8 8
6 6
2 6
4 4 2
1 4 7 7
3 3
2 4 1
4 2 1
2 2 1
4 4 1
2 2 9 7
1 2
5 5
3 3 2
7 5 1
0 0 0 0

Sample Output
28.0000
0.0000
25.8214

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-12-31 02:08
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题