I would like to know if there is a way to improve the accuracy of the tilt calculation. (It appeared a few months ago here ).
It seems to change:
float get_slope(float dXa, float dXb, float dYa, float dYb) { return (dXa - dXb)/(dYa - dYb); }
to
float get_slope(float dXa, float dXb, float dYa, float dYb) { return dXa/(dYa - dYb) - dXb/(dYa - dYb); }
may be an improvement. Suggestions?
Edit: this is the accuracy that I have achieved, not efficiency.
Move them to double inside the function.
, , , . . , . , , y , . , - deltax deltay 1/. atan2().
, , , , , float , . , , Atari BASIC , 6502 BCD.
, . ,
return dXa/(dYa - dYb) - dXb/(dYa - dYb);
, , , . dXa dXb , .
, , .
A B.
{( - (-)), ( - (-)} {( + ( - )), (Yb + (Ya - Yb) )}... A - B +.
. ( ), .
Source: https://habr.com/ru/post/1709227/More articles:How to use assembly without a strong name in SSIS - .netConfiguring the Entity Framework in an Undefined Database Foreign Key Relationships - c #Hibernate/JPA Parent-Child - Π½ΠΎΡΠΌΠ°Π»ΡΠ½ΠΎ Π»ΠΈ Π΄Π»Ρ Parent equals()/hashCode() ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡ Π±Π°Π·Ρ Π΄Π°Π½Π½ΡΡ ? - javaGDI +: ΠΊΠ°ΠΊ Π²Ρ Π²ΠΈΠ·ΡΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅ΡΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡ Graphics Π΄Π»Ρ ΡΠ°ΡΡΡΠΎΠ²ΠΎΠ³ΠΎ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ Π² ΡΠΎΠ½ΠΎΠ²ΠΎΠΌ ΠΏΠΎΡΠΎΠΊΠ΅? - multithreadingSearch VoIP Provider - apiCan I use Source Safe over the Internet? - version-controlAny free alternative to ASP.net management calendar? - c #Has anyone used the YAWS server as an HTTP proxy? - httpWhy do I get Stream as System.IO.UnmanagedMemoryStream? - c #ΠΠ°ΠΊ Ρ ΠΌΠΎΠ³Ρ ΡΠΎΠ·Π΄Π°ΡΡ ΡΡΠ½ΠΊΡΠΈΡ jQuery, ΠΊΠΎΡΠΎΡΠ°Ρ ΡΠΆΠΈΠΌΠ°Π΅Ρ ΡΡΡΠΎΠΊΡ, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡ ΠΌΠ΅ΡΠΎΠ΄ Π΄Π²ΠΎΠΈΡΠ½ΠΎΠ³ΠΎ ΠΏΠΎΠΈΡΠΊΠ°? - javascriptAll Articles