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

View source: R/RcppExports.R

project_to_segmentsR 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 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

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 Oct. 11, 2022, 5:07 p.m.