当前位置:网站首页>Swiftui swift internal skill how to perform automatic trigonometric function calculation in swift
Swiftui swift internal skill how to perform automatic trigonometric function calculation in swift
2022-07-07 11:45:00 【Knowledge fatness】
No one likes math , This is the truth . So what can we do to completely eliminate it from our lives ? No , This is not a robot . Maybe one day I will write these . Who knows ! But for now , You will have to solve functions and formulas .
Are you ready to leave the past calculator ? Let's see how to simplify trigonometric functions for our project .
principle
For those who are not familiar with trigonometry , Let me quote myself from another tutorial , Like an absolutely self-centered nerd ( Although it's actually just laziness ):
Basically , In a right triangle , You can calculate the length of the triangle side , The premise is that you at least :
- The degree of an angle ( In our case , The one I highlighted in yellow ),
- And one of the three sides of size ( In our case , Blue dotted line ).
As you can see from the diagram , This logic can be applied to an invisible circle around our middle button , By using the formula in the figure x and y Value to define three buttons ( green ) The location of .
This theory is useful for any structure involving circles . for example , In that tutorial , I'm explaining how to determine the position of the green dot in the picture from the center of the circle , So that I can treat them as three UIButtons The center of the position .
Trigonometry tells us :
- sin θ = Opposite side / hypotenuse
- cos θ = adjacent / hypotenuse
- tan θ = Opposite side / Adjacent edge
If you look at the picture above ,“θ” It's a yellow angle ,“x” Is an adjacent edge &
边栏推荐
- Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
- 关于SIoU《SIoU Loss: More Powerful Learning for Bounding Box Regression Zhora Gevorgyan 》的一些看法及代码实现
- Le Cluster kubernets en cours d'exécution veut ajuster l'adresse du segment réseau du pod
- 使用MeterSphere让你的测试工作持续高效
- Apprentissage comparatif non supervisé des caractéristiques visuelles par les assignations de groupes de contrôle
- 【滤波跟踪】基于matlab扩展卡尔曼滤波EKF和无迹卡尔曼滤波UKF比较【含Matlab源码 1933期】
- 简单介绍一下闭包及它的一些应用场景
- Briefly introduce closures and some application scenarios
- . Net Maui performance improvement
- QT | multiple windows share a prompt box class
猜你喜欢
【滤波跟踪】基于matlab捷联惯导仿真【含Matlab源码 1935期】
分布式数据库主从配置(MySQL)
Design intelligent weighing system based on Huawei cloud IOT (STM32)
Leetcode - interview question 17.24 maximum submatrix
About how to install mysql8.0 on the cloud server (Tencent cloud here) and enable local remote connection
How to write test cases for test coupons?
正在運行的Kubernetes集群想要調整Pod的網段地址
Tsinghua Yaoban programmers, online marriage was scolded?
Technology sharing | packet capturing analysis TCP protocol
What development models did you know during the interview? Just read this one
随机推荐
【最短路】ACwing 1127. 香甜的黄油(堆优化的dijsktra或spfa)
TDengine 社区问题双周精选 | 第二期
How much do you know about excel formula?
简单介绍一下闭包及它的一些应用场景
Learning notes | data Xiaobai uses dataease to make a large data screen
LeetCode - 面试题17.24 最大子矩阵
Nuclear boat (I): when "male mothers" come into reality, can the biotechnology revolution liberate women?
[question] Compilation Principle
Complete collection of common error handling in MySQL installation
[encapsulation of time format tool functions]
Solve the problem that vscode can only open two tabs
Talk about SOC startup (VI) uboot startup process II
Reasons for the failure of web side automation test
Talk about SOC startup (x) kernel startup pilot knowledge
STM32 entry development write DS18B20 temperature sensor driver (read ambient temperature, support cascade)
自律,提升自制力原来也有方法
Internet Protocol
R语言使用magick包的image_mosaic函数和image_flatten函数把多张图片堆叠在一起形成堆叠组合图像(Stack layers on top of each other)
How to write test cases for test coupons?
Drive HC based on de2115 development board_ SR04 ultrasonic ranging module [source code attached]