Menu

#4961 Convert a bunch of C++ internals to degrees rather than radians

Verified
Enhancement
2016-11-04
2016-08-29
No

Convert a bunch of C++ internals to degrees rather than radians

Degrees make for more "predictable" results in graphics applications
when care is taken to work as exactly as possible in the vicinity of
multiples of 45 degrees.

This provides also functions ly:length, ly:directed and ly:angle to
Scheme in order to facilitate work in degrees there. A number of
operations relevant only to complex analysis/arithmetic rather than
vector operations are removed from the Offset type in order not to
encourage their use.

Contains commits:

Remove complex{conjugate,divide,exp}, Offset::arg

They are promoting aspects of Offset not well-suited to graphics.

Let make_partial_ellipse_boxes use degrees

Change rotations to degrees rather than radians

Or replace them with something not requiring angles altogether.

Simplify polar->rectangular

Add ly:length, ly:directed, ly:angle

Those are functions working on and/or producing coordinate pairs, usually
based on angles expressed in degrees.

Add offset_directed (Real)

This converts an angle in degrees into a unit vector.

Make Offset::angle_degrees () deliver nicer angles

Multiples of 45 degrees should be returned exactly.

http://codereview.appspot.com/305380043

Discussion

  • Anonymous

    Anonymous - 2016-08-30
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2016-08-30

    Passes make, make check and a full make doc.

     
  • David Kastrup

    David Kastrup - 2016-08-30

    Allow ly:directed to take a 2D magnitude

    http://codereview.appspot.com/305380043

     
  • Anonymous

    Anonymous - 2016-08-30
    • Needs: -->
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2016-08-30

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2016-09-02
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2016-09-02

    Patch on countdown for Sept 5th

     
  • Anonymous

    Anonymous - 2016-09-05
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2016-09-05

    Patch counted down - please push.

     
  • David Kastrup

    David Kastrup - 2016-09-07
    • labels: --> Fixed_2_19_48
    • status: Started --> Fixed
    • Patch: push -->
     
  • David Kastrup

    David Kastrup - 2016-09-07

    Pushed to staging as
    commit c16c8655784da3f7d1d20640ef0208a36bdeeaee
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 11:45:41 2016 +0200

    Issue 4961/7: Remove complex{conjugate,divide,exp}, Offset::arg
    
    They are promoting aspects of Offset not well-suited to graphics.
    

    commit 1f3023623452d4fc38570eba85853de499e31ca7
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 11:24:51 2016 +0200

    Issue 4961/6: Let make_partial_ellipse_boxes use degrees
    

    commit 28d3a736534f3aa3cd403485770a019bd35114c4
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 10:10:52 2016 +0200

    Issue 4961/5: Change rotations to degrees rather than radians
    
    Or replace them with something not requiring angles altogether.
    

    commit 16a2d2cb8c7fac8a64b76856dd7c1af343957a21
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 06:50:01 2016 +0200

    Issue 4961/4: Simplify polar->rectangular
    

    commit aca522d3460b83df6a893e9d0cc43378f7e97f6e
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 01:14:43 2016 +0200

    Issue 4961/3: Add ly:length, ly:directed, ly:angle
    
    Those are functions working on and/or producing coordinate pairs, usually
    based on angles expressed in degrees.
    

    commit 1cab9ca99b60c249f4f813746e91070dbd745a4f
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 01:13:15 2016 +0200

    Issue 4961/2: Add offset_directed (Real)
    
    This converts an angle in degrees into a unit vector.
    

    commit 929f0b6293823fa87153a50501fbe609afebcfa2
    Author: David Kastrup dak@gnu.org
    Date: Mon Aug 29 01:11:48 2016 +0200

    Issue 4961/1: Make Offset::angle_degrees () deliver nicer angles
    
    Multiples of 45 degrees should be returned exactly.
    
     
  • Federico Bruni

    Federico Bruni - 2016-11-04
    • status: Fixed --> Verified