编程介的小学生 2017-08-28 07:46 采纳率: 20.5%
浏览 632
已采纳

Euclid

Description

In one of his notebooks, Euclid gave a complex procedure for solving the following problem. With computers, perhaps there is an easier way.

In a 2D plane, consider a line segment AB, another point C which is not collinear with AB, and a triangle DEF. The goal is to find points G and H such that:

H is on the ray AC (it may be closer to A than C or further away, but angle CAB is the same as angle HAB)
ABGH is a parallelogram (AB is parallel to HG, AH is parallel to BG)
The area of parallelogram ABGH is the same as the area of triangle DEF

Input

There will be several test cases. Each test case will consist of twelve real numbers, with no more than 3 decimal places each, on a single line. Those numbers will represent, in order:

AX AY BX BY CX CY DX DY EX EY FX FY

where point A is (AX,AY), point B is (BX,BY), and so on. Points A, B and C are guaranteed to NOT be collinear. Likewise, D, E and F are also guaranteed to be non-collinear. Every number is guaranteed to be in the range from -1000.0 to 1000.0 inclusive. End of the input will be signified by a line with twelve 0.0's.
Output

For each test case, print a single line with four decimal numbers. These represent points G and H, like this:

GX GY HX HY

where point G is (GX,GY) and point H is (HX,HY). Print all values rounded to 3 decimal places of precision (NOT truncated). Print a single space between numbers. Do not print any blank lines between answers.
Sample Input

0 0 5 0 0 5 3 2 7 2 0 4
1.3 2.6 12.1 4.5 8.1 13.7 2.2 0.1 9.8 6.6 1.9 6.7
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Sample Output

5.000 0.800 0.000 0.800
13.756 7.204 2.956 5.304

  • 写回答

1条回答

  • threenewbee 2017-09-11 15:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)