向量旋转 UPC 2217
2015-04-29 20:32
211 查看
这道题目是13山东省省赛的签到题,题目大意是给等边三角形的两个定点,让求逆时针旋转之后的第三个点的坐标,原来不会向量的旋转,在网上找了找,找到一篇挺好的,直接贴过来。
向量的旋转
实际做题中我们可能会遇到很多有关及计算几何的问题,其中有一类问题就是向量的旋转问题,下面我们来具体探讨一下有关旋转的问题。
首
View Code
向量的旋转
实际做题中我们可能会遇到很多有关及计算几何的问题,其中有一类问题就是向量的旋转问题,下面我们来具体探讨一下有关旋转的问题。
首
/************************************************************************* > File Name: upc_2217.cpp > Author: Howe_Young > Mail: 1013410795@qq.com > Created Time: 2015年04月29日 星期三 20时03分21秒 ************************************************************************/ #include <cstdio> #include <iostream> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> using namespace std; int main() { int t; double x1, y1, x2, y2; scanf("%d", &t); while (t--) { scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); double x3, y3; x3 = (x2 - x1) * 0.5 - (y2 - y1) * sqrt(3.0) / 2.0 + x1; y3 = (y2 - y1) * 0.5 + (x2 - x1) * sqrt(3.0) / 2.0 + y1; printf("(%.2f,%.2f)\n", x3, y3); } return 0; }
View Code
相关文章推荐
- 定向和旋转向量四元数之间的关系
- poj2991 Crane 向量旋转+线段树
- HDU1700->向量旋转
- HDU 1700 || Points on Cycle (向量旋转,圆上等边三角形的周长最长
- <编程珠玑>向量旋转(旋转交换) 第三种方法实现代码, 杂耍,其实也没那么容易出错.
- Any Way You Slice It (向量旋转 以及 判断线段是否相交)(模板)
- 根据旋转前后的向量值求旋转矩阵
- 向量的旋转算法---编程珠玑读书笔记。
- leetcode 396. Rotate Function 旋转向量的计算 + 寻找规律
- 【摘】探讨:向量(方向)之间的插值-四元数法VS.旋转矩阵法的性能比较
- 旋转不变LBP以及特征向量的提取方式
- 编程珠玑 一维向量左旋转
- unity 利用四元数旋转向量时出错 解决方法
- 四元数运动学笔记(2)旋转向量,旋转矩阵和四元数的关系
- 旋转向量
- 向量的旋转
- 空间向量绕任一向量旋转计算
- 坐标系转换之三:欧拉角、四元数、旋转矩阵、方向余弦矩阵、旋转向量、轴角表示
- Initialize a Quaternion with one vector rotating to another direction 根据向量旋转方向来初始化四元数
- 二维向量旋转