project_to_segments {dynutils} | R Documentation |
Project a set of points to to set of segments
Description
Finds the projection index for a matrix of points x
, when
projected onto a set of segments defined by segment_start
and segment_end
.
Usage
project_to_segments(x, segment_start, segment_end)
Arguments
x |
a matrix of data points. |
segment_start |
a matrix of segment start points. |
segment_end |
a matrix of segment end points. |
Value
A list with components
x_proj |
a matrix of projections of |
segment |
the index of the segment a point is projected on |
progression |
the progression of a projection along its segment |
distance |
the distance from each point in |
Examples
x <- matrix(rnorm(50, 0, .5), ncol = 2)
segfrom <- matrix(c(0, 1, 0, -1, 1, 0, -1, 0), ncol = 2, byrow = TRUE)
segto <- segfrom / 10
fit <- project_to_segments(x, segfrom, segto)
str(fit) # examine output
[Package dynutils version 1.0.11 Index]