???Line Segments Clipped by Windows

A rectangular area specified in world coordinates is called a window. The rectangular area on the display device to which a window is mapped is called a viewport. The picture elements that fall within this window area is visible. In the viewport there is a block which is given higher priority for displaying. That is, those line segments that falls behind the block will not be visible. Assume the boundaries of a viewport: x=x_{min}x=xminx=x_{max}x=xmaxy=y_{min}y=yminy=y_{max}y=ymax, the boundaries of block: x'=x'_{min}x=xminx'=x'_{max}x=xmaxy'=y'_{min}y=yminy'=y'_{max}y=ymax, and (x_{i1}\ , y_{i1} )(xi1 ,yi1) (x_{i2}\ , y_{i2})(xi2 ,yi2) : he endpoints of the lines in device coordinates.

Please calculate the coordinate value of the endpoints of all the visible line.

Input Format:

The boundaries of a viewport and block, endpoints of the lines in device coordinates.

x_{min}xmin y_{min}ymin x_{max}xmax y_{max}ymax

x'_{min}xmin y'_{min}ymin x'_{max}xmax y'_{max}ymax

x_{11}x11 y_{11}y11 x_{12}x12 y_{12}y12

x_{21}x21 y_{21}y21 x_{22}x22 y_{22}y22

......

x_{n1}xn1 y_{n1}yn1 x_{n2}xn2 y_{n2}yn2

Output Format:

Endpoints of all the visible lines. Please sort the coordinate values of x'_{i1}xi1 ’s in descending order.

x'_{11}x11 y'_{11}y11 x'_{12}x12 y'_{12}y12

x'_{21}x21 y'_{21}y21 x'_{22}x22 y'_{22}y22

......

x'_{k1}xk1 y'_{k1}yk1 x'_{k2}xk2 y'_{k2}yk2

Note:

1. x'_{i1}\ <\ x'_{i2}xi1 < xi2

2. In the condition of only the endpoints of the segments are falling on the boundaries of the viewport or block and the other part is invisible, please neglect it.

3. Integers: x_{min}xminy_{min}ymin , x_{max}xmax , y_{max}ymaxx'_{min}xmin , y'_{min}ymin , x'_{max}xmax , y'_{max}ymax ; float: x_{ij}xijy_{ij}yij.

4. All float number should be accurate to 10^{-4}104

样例输入
0 0 5 5
1 2 2 3
3.0 3.0 7.0 7.0
9.0 7.0 2.0 6.0
4.0 2.0 1.1 4.0
9.0 -1.0 5.1 7.0
2.0 2.0 1.0 3.0
-2.5 3.1 5.2 -3.0
-1.0 7.3 -2.1 0.6
-2.1 5.6 6.0 7.0
-0.7 2.1 -5.2 12.6
样例输出
3.0000 3.0000 5.0000 5.0000
1.1000 4.0000 4.0000 2.0000
0.0000 1.1195 1.4131 0.0000
题目来源

2017 ACM-ICPC 亚洲区(南宁赛区)网络赛

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值