Sdk: Add degree to radian conversion routines to Math

Created on 26 Jul 2012  路  6Comments  路  Source: dart-lang/sdk

_This issue was originally filed by domi...@google.com_


Math already has PI as a constant, it would be trivial to add some utility methods to convert between degrees and radians.

static num degToRad(num deg) => deg * (Math.PI / 180.0);
static num radToDeg(num rad) => rad * (180.0 / Math.PI);

area-library closed-not-planned type-enhancement

Most helpful comment

Degrees are used by many developers to visualise and work with angular values. I believe to include a library to two additional "helper" functions that are expected by most developers seems a bit ridiculous. The other point here is that most trigonometric libraries include this functionality (including android). Important point if we consider we'd like developers to port their libraries to Dart and Flutter.

I'd like to propose that this ticket is reopened and the additions made. I am happy to PR them.

Edit: Please thumbs up the issue not the comment.

All 6 comments

_Added Triaged label._

_This comment was originally written by @austincummings_


Has this been added to the library yet?

_Removed Type-Defect label._
_Added Type-Enhancement label._

We don't have any current plans of adding this to the math library.
The trigonometric functions there all uses radians.

If the need is there, someone could write a package that uses degrees instead, which would be a much more consistent solution.


_Added NotPlanned label._

Degrees are used by many developers to visualise and work with angular values. I believe to include a library to two additional "helper" functions that are expected by most developers seems a bit ridiculous. The other point here is that most trigonometric libraries include this functionality (including android). Important point if we consider we'd like developers to port their libraries to Dart and Flutter.

I'd like to propose that this ticket is reopened and the additions made. I am happy to PR them.

Edit: Please thumbs up the issue not the comment.

I don't know why such helpful methods haven't added yet, it just a bit of code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

55555Mohit55555 picture 55555Mohit55555  路  3Comments

DartBot picture DartBot  路  3Comments

xster picture xster  路  3Comments

brooth picture brooth  路  3Comments

DartBot picture DartBot  路  3Comments