ray: Line between two points

Description Usage Arguments Value Examples

View source: R/ray.R

Description

The function connects two points into a line segment.

Usage

1
ray(from, to)

Arguments

from

A SpatialPoints* object specifying origin.

to

A SpatialPoints* object specifying destination.

Value

A SpatialLines object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ctr = rgeos::gCentroid(build)
angles = seq(0, 359, 20)
sun = mapply(
  shadow:::.sunLocation,
  sun_az = angles,
  MoreArgs = list(
    location = ctr,
    sun_elev = 10)
)
rays = mapply(ray, MoreArgs = list(from = ctr), to = sun)
rays$makeUniqueIDs = TRUE
rays = do.call(rbind, rays)
plot(rays)
sun = do.call(rbind, sun)
text(sun, as.character(angles))

shadow documentation built on March 15, 2021, 1:07 a.m.

Related to ray in shadow...