matrixPythagoras: matrixPythagoras

Description Usage Arguments Value Examples

View source: R/move.R

Description

Uses the Pythagorean theorem to calculate the strightline distance between two matrix cells.

Usage

1
matrixPythagoras(position1, position2, matsize)

Arguments

position1

integer, first positions in distance calc - must be supplied as cell ID

position2

integer, second positions in distance calc - must be supplied as cell ID #' @param matsize integer, the size in number of cells of one side of the square matrix on which the simulation is being run.

Value

returns the pythogorean distance between two coordinates (supplied as matirx indices)

Examples

1
2
#create an example ID matrix for `IDmat`. Example uses a 100x100 matrix
mat <- matrix(1:10000, nrow = 100)

syanco/checkyourself documentation built on Jan. 18, 2021, 4:50 a.m.