dot-distancePointSegment: Calculate shortest distance between point and line segment

.distancePointSegmentR Documentation

Calculate shortest distance between point and line segment

Description

This function calculates the shortest distance between a point and a line segment in 2D space.

Usage

.distancePointSegment(x, y, x1, y1, x2, y2)

Arguments

x

x-coordinate of point

y

y-coordinate of point

x1

x-coordinate of one endpoint of the line segment

y1

y-coordinate of line segment endpoint with x-coordinate x1

x2

x-coordinate of other endpoint of line segment

y2

y-coordinate of line segment endpoint with x-coordinate x2

Value

numeric The shortest distance between a point and a line segment

Examples

.distancePointSegment(0, 0, -1, 1, 1, -1)


bhklab/CoreGx documentation built on March 14, 2024, 3:04 a.m.