UVA - 10250 The Other Two Trees

Problem E

The Other Two Trees

Input: standard input

Output: standard output

Time Limit: 2 seconds

 

You have a quadrilateral shaped land whose opposite fences are of equal length. You have four neighbors whose lands are exactly adjacent to your four fences, that means you have a common fence with all of them. For example if you have a fence of length d in one side, this fence of length d is also the fence of the adjacent neighbor on that side. The adjacent neighbors have no fence in common among themselves and their lands also don’t intersect. The main difference between their land and your land is that their lands are all square shaped. All your neighbors have a tree at the center of their lands. Given the Cartesian coordinates of trees of two opposite neighbors, you will have to find the Cartesian coordinates of the other two trees.

 

Input

The input file contains several lines of input. Each line contains four floating point or integer numbers x1, y1, x2, y2, where (x1, y1), (x2, y2) are the coordinates of the trees of two opposite neighbors. Input is terminated by end of file.

 

Output

For each line of input produce one line of output which contains the line “Impossible.” without the quotes, if you cannot determine the coordinates of the other two trees. Otherwise, print four floating point numbers separated by a single space with ten digits after the decimal point ax1, ay1, ax2, ay2, where (ax1, ay1)  and (ax2, ay2) are the coordinates of the other two trees. The output will be checked with special judge program, so don’t worry about the ordering of the points or small precision errors. The sample output will make it clear.

 

Sample Input

10 0 -10 0

10 0 -10 0

10 0 -10 0

 

Sample Output

0.0000000000 10.0000000000 0.0000000000 -10.0000000000

0.0000000000 10.0000000000 -0.0000000000 -10.0000000000

0.0000000000 -10.0000000000 0.0000000000 10.0000000000



题意:

已知两点,旋转90度之后的两个端点的坐标的值;

利用中点以及sin 和cos进行相关转化就可求出;

还有一种使用向量方法进行;




#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;

int main(){
	double x1,x2;
	double y1,y2;
	double sin,cos;

	while(scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2) != EOF)
	{
		double x = (x1 + x2) / 2;
		double y = (y1 + y2) / 2;
		double d = sqrt ((x1-x2)*(x1- x2) + (y1 - y2)*(y1-y2));
		sin =( y2 - y1 ) / d;
		cos =( x2 - x1 ) / d;
		double x3 = x - d * sin * 0.5;
		double y3 = y + d * cos * 0.5;
		double x4 = x + d * sin * 0.5;
		double y4 = y - d * cos * 0.5;
		printf("%.10lf %.10lf %.10lf %.10lf\n",x3,y3,x4,y4);	
	
	
	}
	return 0;
}


内容概要:本文详细介绍了QY20B型汽车起重机液压系统的设计过程,涵盖其背景、发展史、主要运动机构及其液压回路设计。文章首先概述了汽车起重机的分类和发展历程,强调了液压技术在现代起重机中的重要性。接着,文章深入分析了QY20B型汽车起重机的五大主要运动机构(支腿、回转、伸缩、变幅、起升)的工作原理及相应的液压回路设计。每个回路的设计均考虑了性能要求、功能实现及工作原理,确保系统稳定可靠。此外,文章还详细计算了支腿油缸的受力、液压元件的选择及液压系统的性能验算,确保设计的可行性和安全性。 适合人群:从事工程机械设计、液压系统设计及相关领域的工程师和技术人员,以及对起重机技术感兴趣的高等院校学生和研究人员。 使用场景及目标:①为从事汽车起重机液压系统设计的工程师提供详细的参考案例;②帮助技术人员理解和掌握液压系统设计的关键技术和计算方法;③为高等院校学生提供学习和研究起重机液压系统设计的实用资料。 其他说明:本文不仅提供了详细的液压系统设计过程,还结合了实际工程应用,确保设计的实用性和可靠性。文中引用了大量参考文献,确保设计依据的科学性和权威性。阅读本文有助于读者深入了解汽车起重机液压系统的设计原理和实现方法,为实际工程应用提供有力支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值