Rcpp alternative of nodes_on_circumference.
Arguments
- object
Object of
object-class.- space_between
Numeric denoting the space to leave between the circumference of the object and the nodes to create. When
outside = TRUE,space_betweendistance is created to the outside of the object, while ifoutside = FALSEthis same distance is created towards the inside of the object. Defaults to5e-2.
Details
Used in the overlap_with_objects function for creating
nodes of which their presence within an agent can be checked in an efficient
way (see moving_options and
in_object). Currently works for all
instances of object-class, but only returns
NULL for the segment-class.
Related to the add_nodes with the main difference
being that the add_nodes adds nodes around or
within an object, while nodes_on_circumference adds nodes directly on
the circumference of an object.
Note that while rectangle-class is not explicitly
mentioned here, this method does work for this class of objects.
Examples
# Create an object
my_circle <- circle(center = c(0, 0), radius = 1)
# Generate nodes that fall around this circle with a distance of 1 around
# the circle
nodes_on_circumference(my_circle, space_between = pi / 2, cpp = TRUE)
#> [,1] [,2]
#> [1,] 1.000000e+00 0.000000e+00
#> [2,] 6.123234e-17 1.000000e+00
#> [3,] -1.000000e+00 1.224647e-16
#> [4,] -1.836970e-16 -1.000000e+00