当前位置:网站首页>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
边栏推荐
- Polarization relay
- How to quickly pass the probation period for newly trained intermediate test engineers
- 我与消息队列的八年情缘
- 全国职业院校技能竞赛网络安全竞赛数据取证与分析思路分析
- Chapter 3 business function development (choose to export market activities, Apache POI)
- Excel only wants to visualize charts and make data move? Yes, come and watch (with a large number of templates to download)
- ADI、世健、骏龙科技共同捐赠230万元助力湖北抗疫
- The source code of live broadcast app system, and the rotation diagram of upper and lower layers
- SQL注入 Less26a(布尔盲注)
- Leetcode-39-total number of combinations
猜你喜欢

七大排序之希尔排序

jumpserver学习

Seven lines of code crashed station B for three hours

高频继电器

Markdown extended syntax

Are Transformers Effective for Time Series Forecasting?| Pit filling

Iptables learning

When type= 'number' is set in the input field, remove the up and down buttons behind it

leetcode383赎金信

全国职业院校技能竞赛网络安全竞赛数据取证与分析思路分析
随机推荐
高频继电器
Leetcode-226-flip binary tree
极化继电器
HC32F4A0 时钟控制
MySQL series - database tables, queries, sorting, and data processing functions
setContentView详解
软件测试的就业前景到底怎么样?
饿了么input输入框设置type=‘number‘时,去掉后面的上下按钮
[SQL] SQL optimization
fork()函数的执行过程、孤儿进程和僵尸进程
Kubernetes二进制部署——理论部分
Direct insertion sort of seven sorts
视频直播源码,uni-app实现广告滚动条
Kubernetes binary deployment - theoretical part
CMOS开关(二)_参数提取
8000 word explanation of OBSA principle and application practice
Uniswap集成sudoswap,能否拉开NFT流动性新序幕?
Credit default prediction based on simplified scorecard, smote sampling and random forest
Buuctf brushes eleven questions (05)
Chapter 8 using web sessions through rest