Opened 16 years ago

Closed 8 years ago

#343 closed task (fixed)

standardize DEG2RAD() etc

Reported by: hamish Owned by: grass-dev@…
Priority: minor Milestone: 7.2.0
Component: Default Version: svn-develbranch6
Keywords: headers, coding style Cc:
CPU: All Platform: All

Description

Hi,

in the source now there is

misc/m.cogo/main.c:#define DEG2RAD(a) ((a) * M_PI / 180.0)
raster/r.param.scale/param.h:     #define DEG2RAD 0.017453293
raster/wildfire/r.ros/spot_dist.c:#define DEG2RAD 0.017453292
raster/r.flow/r.flow.h:#define DEG2RAD  0.0174532925199432958

it would be good to standardize these in gis.h just following the M_PI section. i.e. add these from m.cogo:

#define DEG2RAD(a) ((a) * M_PI / 180.0)
#define RAD2DEG(a) ((a) * 180.0 / M_PI)
#define DMS2DD(d,m,s) ((d) + ((m) / 60.0) + ((s) / 3600.0))
  • DMS2DD bug: if deg is negative (45:30S) -> -45 + .5 = -44.5

... or do the macros have to be in the same source file to be kept efficient?

Hamish

Change History (6)

in reply to:  description comment:1 by hamish, 16 years ago

Replying to hamish:

#define DMS2DD(d,m,s) ((d) + ((m) / 60.0) + ((s) / 3600.0))

  • DMS2DD bug: if deg is negative (45:30S) -> -45 + .5 = -44.5

nope, out->n_s is stored separately from out->lat in m.cogo. This is easy to forget, so dangerous to put in gis.h in hindsight.

Hamish

comment:2 by neteler, 9 years ago

Milestone: 6.4.06.4.6

comment:3 by neteler, 8 years ago

Solved in r68881 (trunk) and r68882 (relbranch72) (without DMS2DD macro)

I'd suggest wontfix for GRASS GIS 6.

comment:4 by martinl, 8 years ago

Resolution: wontfix
Status: newclosed

comment:5 by wenzeslaus, 8 years ago

Milestone: 6.4.67.2.0
Resolution: wontfix
Status: closedreopened

Since this was actually fixed, closing as fixed with different milestone.

To excuse the additional noise: I think closing as solved (if possible) is good for moral in general and understanding the history in this case.

comment:6 by wenzeslaus, 8 years ago

Keywords: headers coding style added
Resolution: fixed
Status: reopenedclosed

fixed but wontfix for 7.0 and 6.4

Note: See TracTickets for help on using tickets.