hdu5733 tetrahedron (求四面体内切球球心+点面距)

tetrahedron
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 569 Accepted Submission(s): 219

Problem Description
Given four points ABCD, if ABCD is a tetrahedron, calculate the inscribed sphere of ABCD.

Input
Multiple test cases (test cases ≤100).

Each test cases contains a line of 12 integers [−1e6,1e6] indicate the coordinates of four vertices of ABCD.

Input ends by EOF.

Output
Print the coordinate of the center of the sphere and the radius, rounded to 4 decimal places.

If there is no such sphere, output “O O O O”.

Sample Input

0 0 0 2 0 0 0 0 2 0 2 0
0 0 0 2 0 0 3 0 0 4 0 0

Sample Output

0.4226 0.4226 0.4226 0.4226
O O O O

Author
HIT

Source
2016 Multi-University Training Contest 1

题意:给你四个点,让你判断是否能形成四面体,如果能形成,求出内切球球心和半径。
思路:因为四个点有可能会形不成四面体,当发生这种情况的时候,肯定会有至少3个点在同一平面,所以说我们要先确定一个平面,然后判断四点共面
1.任取三个点,判断是否共线,如果存在3个点共线,则必不可能形成四面体。
2.当满足1后,判断第四个顶点距离底面的距离,如果小于eps,说明四点共面,则必不可能形成四面体,点面距离公式为:

d=|PQn||n|

其中 P 为所求点, Q 为平面上任意一点, n 为平面法向量,法向量可以通过叉积求得。
3.当1、2都满足的时候,说明可以形成四面体,就要求它的内切球球心了,根据公式得:球心坐标(X,Y,Z),求法为:
X=4i=1si
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值