## Bug #570

### Plotting of repeated symbols at periodic boundaries

Status: | Closed | Start date: | 2014-05-29 | |
---|---|---|---|---|

Priority: | Normal | Due date: | ||

Assignee: | Paul | % Done: | 100% | |

Category: | - | |||

Target version: | Candidate for next minor release | |||

Affected version: | all | Platform: |

**Description**

A symbol plotted at (lon,lat) on a 360-degree periodic map (e.g. Mercator, Mollweide, etc.) may be clipped by the boundary and should appear at the other side. To visualize, consider a 1 cm diameter circle plotted at lon = 1 on Equator, with -R0/360. Part of that circle may be clipped by the west = 0 boundary, However, that boundary is periodic so the clipped part of the circle should appear at the east = 360 boundary. We discussed a solution to this via email, now entered here for reference:

If projection is among cylindrical, conical and miscellaneous, or linear with degrees, and w-e == 360, then we must plot symbols twice, with clipping on:

First at the given plot_x, plot_y location

Second at the repeating point which is outside the map region.

if (lon-west) > 180 plot to left of west boundary else plot to right of east boundary

The only complication I see is if user wants **-N**. Perhaps we should expand -N to take some options:

**-N** No clip and show those repeating symbols if test above passes [Default]**-Nr** No clip and no repeating symbols**-Nc** Retain clipping but do not deal with repeating symbols

I can imagine **-Nc** be useful when plotting millions of smaller symbols and we don't want to plot 2 millions needlessly.

A possible implementation:

<we compute plot_x and plot_y, the locations in inches on the current map, and skip if outside> shift[0] = shift[1] = 0.0; n_times = 1; symbol_size = <size of symbol or major axis of ellipse, rectangle> right_margin = map_width - symbol_size; xpos[0] = plot_x; /* Location of symbol */ if (periodic_boundary) { /* Must check if plotting close to map edge */ if (plot_x < symbol_size) { /* Might reappear at right edge */ xpos[1] = xpos[0] + 2*GMT_half_map_width (GMT, plot_y) /* Since not all projections have straight w/e boundaries */ n_times = 2; } else if (plot_x > right_margin) { /* Might reappear at left edge */ xpos[1] = xpos[0] - 2*GMT_half_map_width (GMT, plot_y); /* Since not all projections have straight w/e boundaries */ n_times = 2; } else /* No, once is enough */ n_times = 1; } for (event = 0; event < n_times; event++) { < point is at xpos[event], plot_y> switch (S.symbol) { case GMT_SYMBOL_CIRCLE: etc etc } }

### Associated revisions

Implemented feature as in issue #570

### History

#### #1 Updated by Paul over 4 years ago

**Status**changed from*New*to*Resolved***% Done**changed from*0*to*100*

Implemented in the 5.2 branch, with a minor twist for the **-N** option:

**-N** No clip and no repeating symbols [Default]**-Nr** No clip and plot repeating symbols**-Nc** Retain clipping but do not plot repeating symbols

If no **-N** is given the clipping is on and repeating symbols are plotted (and being clipped). In r13237.

#### #2 Updated by Paul about 4 years ago

**Status**changed from*Resolved*to*Closed*

I am closing this for now.