Created with <3 with dartpad.dev.
Created
December 29, 2022 08:41
-
-
Save NicholasSterling/87b34f3d8b68b06e45c43284eadeadb4 to your computer and use it in GitHub Desktop.
fluttering-toast-6811
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
import 'package:vector_math/vector_math.dart'; | |
// Here we calculate the angle in Z of the midLine | |
// of a woman standing straight up. | |
void main() { | |
var ls = Vector3( | |
0.5335670709609985, | |
0.3110794723033905, | |
-0.11455275863409042, | |
); | |
var rs = Vector3( | |
0.46176043152809143, | |
0.3107919692993164, | |
-0.13316287100315094, | |
); | |
var lh = Vector3( | |
0.5170937180519104, | |
0.4952668845653534, | |
-0.00006440694414777681, | |
); | |
var rh = Vector3( | |
0.4780965745449066, | |
0.4948005974292755, | |
0.0000033577264275663765, | |
); | |
var ms = (ls + rs) / 2.0; // mid-shoulders | |
var mh = (lh + rh) / 2.0; // mid-hips | |
var ml = (ms - mh); // midLine | |
var mln = ml.normalized(); // midLine normalized | |
print(mln); | |
print(asin(mln.z) * 180 / 3.1416); // prints -34 (roughly) degrees | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment