Bug #1104
grdvector -Q+je gives the same result as +jc in non-geographical (Cartesian) mode
Status: | Closed | Start date: | 2017-05-27 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % 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.psboth 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.
History
#1
Updated by Paul almost 4 years 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 almost 4 years 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.