Bug #1104

grdvector -Q+je gives the same result as +jc in non-geographical (Cartesian) mode

Added by Masakazu about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:2017-05-27
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:

Description

When I tried

gmt grdvector u.grd v.grd -Q+je -JX10 -W > vector+je.ps
gmt grdvector u.grd v.grd -Q+jc -JX10 -W > vector+jc.ps
both give the same results in which vectors are aligned at their centers.

The vector justification is controlled at source:trunk/src/grdvector.c#L568

justify = PSL_vec_justify (Ctrl->Q.S.v.status);        /* Return justification as 0-2 */
if (justify) {        /* Justify vector at center, or tip [beginning] */
    x_off = justify * 0.5 * (x2 - plot_x);        y_off = justify * 0.5 * (y2 - plot_y);

The variable "justify" is supposed to take the value 0, 1 or 2, but it is declared as "bool" at source:trunk/src/grdvector.c#L320. So, when PSL_vec_justify() returns 2, the value 2 may be cast to bool "true", and be stored in "justify" as "true" (=1).

I think this can be fixed by declaring the variable "justify" as int or unsigned int.

Associated revisions

Revision 18253
Added by Paul about 1 month ago

Fix issue #1104

History

#1 Updated by Paul about 1 month ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Thanks for the very clear identification of the problem which saved us much time. Fixed in r18253.

#2 Updated by Masakazu about 1 month ago

Thank you very much for your prompt response. I applied the fix of r18253 to my environment, and confirm the problem has been fixed.

#3 Updated by Paul about 1 month ago

  • Status changed from Resolved to Closed

Closed as fixed.

Also available in: Atom PDF