range_translation: Returns a function to translate a point A on a scale with...

Description Usage Arguments Value Examples

View source: R/two_range_translation.R

Description

Returns a function to translate a point A on a scale with range (o_min, o_max) to a point B in a range (n_min, n_max)

Usage

1
range_translation(old_max, old_min = 0, new_max = 1, new_min = -1)

Arguments

old_max

Double to indicate the maximum value in pixels of an image's selected axis

old_min

Integer to indicate starting position (0) in pixels of an images selected axis

new_max

Double to indicate the maximum position of the translated image's selected axis

new_min

Double to indicate the minimum position of the translated image's selcted axis

Value

Function translation(old_position) can be called to give the new position

Examples

1
2
3
4
5
6
7
i_translation <- range_translation(5000)
x_translation <- range_translation(4000, 0, 2, -2)
y_translation <- range_translation(3000, 0, 3/2, -3/2)

fixed_coordinate_i <- i_translation(2500)
fixed_coordinate_x <- x_translation(2000)
fixed_coordinate_y<- -y_translation(1500)

MilesMcBain/r2vr documentation built on March 29, 2021, 12:03 p.m.