Skip to content

Instantly share code, notes, and snippets.

@NicholasSterling
Created December 29, 2022 08:41
Show Gist options
  • Save NicholasSterling/87b34f3d8b68b06e45c43284eadeadb4 to your computer and use it in GitHub Desktop.
Save NicholasSterling/87b34f3d8b68b06e45c43284eadeadb4 to your computer and use it in GitHub Desktop.
fluttering-toast-6811

fluttering-toast-6811

Created with <3 with dartpad.dev.

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