commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex D Herbert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NUMBERS-70) Userguide and reports
Date Wed, 03 Apr 2019 15:17:00 GMT

    [ https://issues.apache.org/jira/browse/NUMBERS-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16808822#comment-16808822
] 

Alex D Herbert commented on NUMBERS-70:
---------------------------------------

To convert an angle in radians to degrees you can skip this library altogether and use the
method that has been in java since 1.2:
{code:java}
final double angleDeg = 180;
final double angleRad = Math.toRadians(angleDeg);
{code}
The {{PlaneAngle}} class encapsulates the idea that an angle is a number of turns around a
circle and provides for creation from different units, normalisation (+/- 0.5 turns) from
a reference number of turns and equality comparisons. A contrived example would be:
{code:java}
final PlaneAngle half = PlaneAngle.ofRadians(Math.PI);
final PlaneAngle threeQuarters = PlaneAngle.ofDegrees(270);

// 1.25 turns
final PlaneAngle halfPlusThreeQuarters = 
        PlaneAngle.ofTurns(half.toTurns() + threeQuarters.toTurns());

assert halfPlusThreeQuarters.equals(PlaneAngle.ofTurns(1.25));

// Normalise to +/- 0.5 of 0.5 is 0.25 turns
assert halfPlusThreeQuarters.normalize(half).equals(PlaneAngle.ofTurns(0.25));
{code}

> Userguide and reports
> ---------------------
>
>                 Key: NUMBERS-70
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-70
>             Project: Commons Numbers
>          Issue Type: Wish
>            Reporter: Gilles
>            Priority: Minor
>              Labels: benchmark, documentation, gsoc2019
>             Fix For: 1.0
>
>         Attachments: 0001-Angles-xdoc-is-added.patch, 0001-Prime-xdoc-file-is-added.patch,
0001-Primes-xdoc-is-added.patch
>
>
> Review contents of the component towards providing an up-to-date userguide and write
benchmarking code for generating performance reports ([JMH|http://openjdk.java.net/projects/code-tools/jmh/]).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message