NoOverlap function

Shift Symbols

Shift Symbols

Shift Symbols such that there is no overlap 1.1

NoOverlap(x, y, focsiz, SEL = 0, OLDx = 0, OLDy = 0, cenx = 0, ceny = 0)

Arguments

  • x: x-location
  • y: y-location
  • focsiz: symbol size
  • SEL: selection of which symbols to shift
  • OLDx: x-locations of origin
  • OLDy: y-locations of origin
  • cenx: center x
  • ceny: center y

Details

Program is used for finding positions for exploding. A vector is dcalculated from each origin to each point and explosions are projected along these directions until a position is found that does not overlap. The position is nudged by a value of focsiz at each step. If OLDx and OLDy are not provided, cenx and ceny are used as origin points.

Returns

x,y list of new positions

Author(s)

Jonathan M. Leesjonathan.lees@unc.edu

See Also

ExplodeSymbols

Examples

draw.circ<-function (x, y, r, ...) { CI = RPMG::circle(1) for (i in 1:length(x)) { Cx = x[i] + r * CI$x Cy = y[i] + r * CI$y lines(c(Cx, Cx[1]), c(Cy, Cy[1]), type = "l", ...) } } x = rnorm(20) y = rnorm(20) rx = range(x) ry = range(y) drx = diff(rx) dry = diff(ry) XPCT=.2 rx = c(rx[1]-XPCT*drx, rx[2]+XPCT*drx) ry = c(ry[1]-XPCT*dry, ry[2]+XPCT*dry) plot(rx , ry , type='n', asp=1, xlab="km", ylab="km") u = par("usr") focsiz = 0.04* (u[2]-u[1]) draw.circ(x, y, focsiz, col='red') NXY = NoOverlap(x,y,focsiz) plot(rx , ry , type='n', asp=1, xlab="km", ylab="km") u = par("usr") focsiz = 0.04* (u[2]-u[1]) draw.circ(NXY$x, NXY$y, focsiz, col="blue" ) segments(x,y,NXY$x, NXY$y)
  • Maintainer: Jonathan M. Lees
  • License: GPL (>= 2)
  • Last published: 2024-07-09

Useful links