angles 1.2.1 copy "angles: ^1.2.1" to clipboard
angles: ^1.2.1 copied to clipboard

outdated

Utility library for handling angles in radians, degrees and turns.

example/angles_example.dart

import 'package:angles/angles.dart';
import 'dart:math' as math;

main() {
  // Various ways to define a half turn:
  final x = Angle.fromDegrees(180.0);
  final y = Angle.fromRadians(math.pi);
  final z = Angle.fromTurns(0.5);
  
  x.degrees; // = 180.0
  x.radians; // = 3.1415...
  x.turns;   // = 0.5

  // One can use built-in trigonometric functions:
  final a = Angle.asin(0.3);
  print(a.sin); // = 0.3
  
  // Angles are immutable, but there are operators like +, creating new angles:
  final threeQuarterTurn = Angle.halfTurn() + Angle.fromDegrees(90.0);
  print(threeQuarterTurn); // 270°
}
19
likes
35
pub points
83%
popularity

Publisher

unverified uploader

Utility library for handling angles in radians, degrees and turns.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

meta

More

Packages that depend on angles