DistanceCheck: Check if Two Points Lie Within some Distance in All...

Description Usage Arguments Value Author(s) Examples

Description

A function to check whether two points lie within some distance in every dimension.

Usage

1
DistanceCheck(point1, point2, dist, dimensions=length(point1))

Arguments

point1

An n dimensional vector representing point1.

point2

An n dimensional vector representing point2.

dist

A floating point number representing the maximum distance in each dimension allowed for points to be considered equivalent.

dimensions

An integer representing the number of dimensions being checked. This defaults to the length of the first vector.

Value

A boolean value is returned. The value is true if the points are within the distance in every dimension and false if not.

Author(s)

Kevin Toohey

Examples

1
2
3
4
5
6
7
# Creating two points.
point1 <- c(0, 2, 4, 6)
point2 <- c(0, 1, 2, 3)

# Running the check with distances 1 and 3 in 4 dimensions.
DistanceCheck(point1, point2, 1, 4)
DistanceCheck(point1, point2, 3, 4)

Example output

[1] FALSE
[1] TRUE

SimilarityMeasures documentation built on May 1, 2019, 10:06 p.m.