当前位置:网站首页>Shandong football match
Shandong football match
2022-07-27 22:43:00 【Round moon】
Football Match
The main idea of the topic
Give a picture scale and give it to you A and B Coordinates of , So we can determine the coordinates of all the key points on this flag . Now we rotate the flag, change the scale and position , Still give you new A and B Coordinates of , Let you find the coordinates of other points .
Ideas
Use the polar coordinate method plus the correction of scale and angle , You can find out all the key points .
Because any point to A The distance between points is proportional , And the included angle is constant , In fact, we need to calculate the corrected angle and proportion, and the corrected length to calculate the trigonometric function !
Code
//#include<unordered_map>
#include<algorithm>
#include<iostream>
#include<string.h>
#include <iomanip>
#include<stdio.h>
#include<vector>
#include<string>
#include<math.h>
#include<cmath>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll ll_inf = 9223372036854775807;
const int int_inf = 2147483647;
const short short_inf = 32767;
const ll less_inf = 0x3f3f3f3f;
const char char_inf = 127;
#pragma GCC optimize(2)
#define accelerate cin.tie(NULL);cout.tie(NULL);ios::sync_with_stdio(false)
#define PI 3.141592653589793
#define EPS 1.0e-8
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
inline ll read() {
ll c = getchar(), Nig = 1, x = 0;
while (!isdigit(c) && c != '-')c = getchar();
if (c == '-')Nig = -1, c = getchar();
while (isdigit(c))x = ((x << 1) + (x << 3)) + (c ^ '0'), c = getchar();
return Nig * x;
}
inline void out(ll a) {
if (a < 0)putchar('-'), a = -a;
if (a > 9)out(a / 10);
putchar(a % 10 + '0');
}
ll qpow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1)res = (res * x) % mod;
x = (x * x) % mod;
n >>= 1;
}
return res;
}
#define read read()
double dislen(double xa, double ya, double xb, double yb)
{
return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
}
double Cos(double a)
{
if (a == 0)return 1;
if (a == 90 || a == 270)return 0;
if (a == 180)return -1;
return cos(a * PI / 180);
}
double Sin(double a)
{
if (a == 0 || a == 180)return 0;
if (a == 90)return 1;
if (a == 270)return -1;
return sin(a * PI / 180);
}
pair<double, double>pos(double xa, double ya, double theat, double r)
{
double x, y;
double COS = 1;
double SIN = 1;
if (theat == 0)
{
COS = 1;
SIN = 0;
}
else if (theat == 90)
{
COS = 0;
SIN = 1;
}
else if (theat == 180)
{
COS = -1;
SIN = 0;
}
else if (theat == 270)
{
COS = 0;
SIN = -1;
}
else
{
COS = cos(theat);
SIN = sin(theat);
}
x = xa + COS * r;
y = ya + SIN * r;
pair<double, double>res;
res.first = x;
res.second = y;
return res;
}
int main()
{
int T = read;
while (T--)
{
double xa, xb, xc, xd, ya, yb, yc, yd;
cin >> xa >> ya >> xb >> yb;
double lenab = dislen(xa, ya, xb, yb);
double lencd = lenab;
double lenad = 1.5 * lenab;
double lenbc = lenad;
double cospian = (yb - ya) / lenab;
double pian = acos(cospian);
if (xb - xa > 0)
pian = 2 * PI - pian;
double tempx, tempy;
tempx = lenbc * cos(pian);
tempy = lenbc * sin(pian);
xc = xb + tempx;
yc = yb + tempy;
xd = xa + tempx;
yd = ya + tempy;
double M = atan((10 + Sin(18) * 6) / (15 - Cos(18) * 6));
double LenM = dislen((15 - Cos(18) * 6), (10 + Sin(18) * 6), 0, 0);
double G = atan((10 + Sin(18) * 6) / (15 + Cos(18) * 6));
double LenG = dislen((15 + Cos(18) * 6), (10 + Sin(18) * 6), 0, 0);
double K = atan((10 - Cos(36) * 6) / (15 - Sin(36) * 6));
double LenK = dislen((15 - Sin(36) * 6), (10 - Cos(36) * 6), 0, 0);
double I = atan((10 - Cos(36) * 6) / (15 + Sin(36) * 6));
double LenI = dislen((15 + Sin(36) * 6), (10 - Cos(36) * 6), 0, 0);
double E = atan(16.0 / 15);
double LenE = dislen(15, 16, 0, 0);
double r2 = (Sin(18) / Sin(126)) * 6;
double N = atan((10 + Sin(54) * r2) / (15 - Cos(54) * r2));
double LenN = dislen((15 - Cos(54) * r2), (10 + Sin(54) * r2), 0, 0);
double F = atan((10 + Sin(54) * r2) / (15 + Cos(54) * r2));
double LenF = dislen((15 + Cos(54) * r2), (10 + Sin(54) * r2), 0, 0);
double L = atan((10 - Sin(18) * r2) / (15 - Cos(18) * r2));
double LenL = dislen((15 - Cos(18) * r2), (10 - Sin(18) * r2), 0, 0);
double H = atan((10 - Sin(18) * r2) / (15 + Cos(18) * r2));
double LenH = dislen((15 + Cos(18) * r2), (10 - Sin(18) * r2), 0, 0);
double J = atan((10.0 - r2) / 15.0);
double LenJ = dislen(15.0, (10.0 - r2), 0, 0);
double Ka = lenab / 20.0;
LenE *= Ka;
LenF *= Ka;
LenG *= Ka;
LenH *= Ka;
LenI *= Ka;
LenJ *= Ka;
LenK *= Ka;
LenL *= Ka;
LenM *= Ka;
LenN *= Ka;
E += pian;
F += pian;
G += pian;
H += pian;
I += pian;
J += pian;
K += pian;
L += pian;
M += pian;
N += pian;
pair<double, double>resE = pos(xa, ya, E, LenE);
pair<double, double>resF = pos(xa, ya, F, LenF);
pair<double, double>resG = pos(xa, ya, G, LenG);
pair<double, double>resH = pos(xa, ya, H, LenH);
pair<double, double>resI = pos(xa, ya, I, LenI);
pair<double, double>resJ = pos(xa, ya, J, LenJ);
pair<double, double>resK = pos(xa, ya, K, LenK);
pair<double, double>resL = pos(xa, ya, L, LenL);
pair<double, double>resM = pos(xa, ya, M, LenM);
pair<double, double>resN = pos(xa, ya, N, LenN);
printf("%.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f ", xc, yc, xd, yd, resE.first, resE.second, resF.first, resF.second, resG.first, resG.second, resH.first, resH.second);
printf("%.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f %.6f\n", resI.first, resI.second, resJ.first, resJ.second, resK.first, resK.second, resL.first, resL.second, resM.first, resM.second, resN.first, resN.second);
}
}
By-Round Moon
边栏推荐
- 中芯国际购买的ASML光刻机顺利进厂,但并未非EUV光刻机!
- Nodejs NPM common instructions summary
- 2021年福建省职业院校技能大赛(中职组)网络安全竞赛任务书
- How to quickly pass the probation period for newly trained intermediate test engineers
- An2021软件安装及基本操作(新建文件/导出)
- What is private traffic?
- 【二叉树】统计二叉树中好节点的数目
- android 11 安全策略及权限管理
- 【OBS】P B 丢帧阈值 buffer_duration_usec
- Leetcode383 ransom letter
猜你喜欢
随机推荐
Reed relay
Wireshark filter rule notes, with software
Deepfake's face is hard to distinguish between true and false, and musk Fenke has disguised successfully
中芯国际购买的ASML光刻机顺利进厂,但并未非EUV光刻机!
Apachespark command execution (cve-2022-33891) vulnerability recurrence
QT常见操作合集
RN搜索高亮显示
Two dimensional code generation based on MCU and two dimensional code display on ink screen
fork()函数的执行过程、孤儿进程和僵尸进程
SSM integration process
8000 word explanation of OBSA principle and application practice
Multi tenant SaaS cloud platform framework
HC32F4A0 时钟控制
Leetcode-309- best time to buy and sell stocks, including freezing period
全国职业院校技能竞赛网络安全竞赛数据取证与分析思路分析
cache学习
美国疫情扩散到28个州:苹果、微软等10多万员工在家办公,iPhone11快断货了!
什么是私域流量?
CMOS开关(二)_参数提取
Hc32f4a0 clock control








