mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-26 08:54:42 +01:00
Add rad and deg conversion fn
This commit is contained in:
parent
610bf688a0
commit
3c2d12d343
2 changed files with 20 additions and 0 deletions
5
app/lib/math_util.dart
Normal file
5
app/lib/math_util.dart
Normal file
|
@ -0,0 +1,5 @@
|
|||
import 'dart:math' as math;
|
||||
|
||||
double degToRad(num deg) => deg * (math.pi / 180);
|
||||
|
||||
double radToDeg(num rad) => rad * (180 / math.pi);
|
15
app/test/math_util_test.dart
Normal file
15
app/test/math_util_test.dart
Normal file
|
@ -0,0 +1,15 @@
|
|||
import 'dart:math' as math;
|
||||
|
||||
import 'package:nc_photos/math_util.dart' as math_util;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group("math_util", () {
|
||||
test("degToRad", () {
|
||||
expect(math_util.degToRad(90), closeTo(1.570796, 1e-6));
|
||||
});
|
||||
test("radToDeg", () {
|
||||
expect(math_util.radToDeg(math.pi), 180);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue