编程介的小学生 2017-09-19 14:19 采纳率: 20.5%
浏览 808
已采纳

STRICTLY INSCRIBED SIMILAR TRIANGLES

Description

Two triangles ABC and XYZ are Similar if their corresponding sides are proportional (or, equivalently if their corresponding angles are equal. We will say that ABC and XYZ are Similar In Order, if A corresponds to X, B corresponds to Y and C corresponds to Z. That is:
|AB|/|XY| = |BC|/|YZ| = |AC|/|XZ|,
where |MN| denotes the length of the line from M to N.
Triangle XYZ is Strictly Inscribed in triangle ABC, if each vertex of XYZ lies in the interior (not at a vertex) of a different edge of ABC. This means that no edge of XYZ can be contained in an edge of ABC. If XYZ is similar in order to ABC and strictly inscribed in ABC, we say that XYZ is a Strictly Inscribed Similar Triangle to ABC.
If the line through X and Y makes an angle θ with the line through A and B, there are four possible orientations illustrated in the figures below. X and Y may be at either end of the segment and the third vertex, Z, may be on either side of the line. In the figures, the line through X and Y makes an angle of 30 degree with the line through A and B.


Depending on the shape of the outside triangle, ABC, and the angle, θ, between the line through X and Y and the line through A and B, there may be 0, 1, 2, 3 or 4 strictly inscribed similar triangles to ABC with angle θ.
Write a program, which takes as input the vertices of the triangle ABC and an angle θ, and computes the vertices of all strictly inscribed similar triangles to ABC for which the line through X and Y makes an angle θ with the line through A and B.
Notes
Use the value: 3.14159253 as the value for π, should you need it.
Input

The first line of the input is a positive integer n which is the number of triangle datasets that follow. Each triangle dataset consists of four lines. The first line has the x and y coordinates of vertex A, the second line has the x and y coordinates of vertex B and the third line has the x and y coordinates of vertex C. The last line has the angle θin degrees between the line through X and Y and the line through A and B.
Output

For each dataset, you will output the number of strictly inscribed similar triangles to ABC satisfying the input conditions. Then, for each such triangle, print a blank line, followed by a line containing the coordinates of vertex X (corresponding to A); a line containing the coordinates of vertex Y (corresponding to B); a line containing the coordinates of vertex Z (corresponding to C); and another blank line. Each coordinate should be given to four decimal places.
Sample Input

2
0 0
21 0
14 6
30
0 0
21 0
14 6
50
Sample Output

2

15.6030 4.6260
7.5905 0.0000
8.9396 3.8313

8.1575 0.0000
15.8312 4.4304
12.0075 5.1461

1

10.0510 0.0000
14.6315 5.4587
11.5450 4.9479

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-05 01:35
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。