project_to_segments: Project a set of points to to set of segments

Description Usage Arguments Value Examples

View source: R/RcppExports.R

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

1
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 x onto the given segments.

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 x to its projection in x_proj

Examples

1
2
3
4
5
6
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

dynutils documentation built on March 22, 2021, 5:06 p.m.