getDistance: distance between two 'Nodes'

Description Usage Arguments Optional Parameters (...) Author(s) Examples

Description

Calculates the euclidian distance between to nodes. Optional this distance can be multiplied by a costfactor in order to convert the distance to cost-related value (such as time, costs, ...).

costfactor * ((x_0-x_1)^2 + (y_0-y_1)^2)^0.5

Usage

1
2
3
4
5
6
7
getDistance(n0, n1, ...)

## S4 method for signature 'numeric,numeric'
getDistance(n0 = c(0, 0), n1, ...)

## S4 method for signature 'Node,Node'
getDistance(n0, n1, ...)

Arguments

n0

an object of class numeric with a length of 2 (x/y-coordinates) or a class derived from Node. Used as origin.

n1

an object of class numeric with a length of 2 (x/y-coordinates) or a class derived from Node.

...

Optional Parameters (See Below).

Optional Parameters (...)

used by getDistance

digits

non negative Integer value for the number of digitis that has to be rounded to.

costfactor

numeric Optional Parameter. Used to transform the distance by a factor into costs. Default is 1.

Forwarded to the follwowing functions

You may want to check these functions for any other optional parameters.

Author(s)

Dipl. Kfm. Felix Lindemann felix.lindemann@hs-neu-ulm.de

Wissenschaftlicher Mitarbeiter Kompetenzzentrum Logistik Buro ZWEI, 17

Hochschule fur angewandte Wissenschaften Fachhochschule Neu-Ulm | Neu-Ulm University Wileystr. 1

D-89231 Neu-Ulm

Phone +49(0)731-9762-1437 Web www.hs-neu-ulm.de/felix-lindemann/ http://felixlindemann.blogspot.de

Examples

1
2
3
4
5
6
# getDistance(c(1,1),c(4,5),costfactor=1) # should result 5.
# getDistance(c(1,1),c(4,5),costfactor=2) # should result 10.
# w1 <- new("Node", x=0, y=0)
# c1 <- new("Node",  x=3, y=4)
# getDistance(w1,c1) # should result 5.
# getDistance(w1,c1,costfactor=3) # should result 15.

felixlindemann/HNUORTools documentation built on May 8, 2019, 6:46 p.m.