position:interpolate
List of: Scheme Extensions
Subjects: Mathematics
Contents: Kernel

Action: Interpolates a new position based on the weight between two given positions.

Filename: kern/kern_scm/pos_scm.cxx

Syntax: (position:interpolate position1 position2 weight)

Arg Types: position1 position

position2 position

weight real

Returns: position

Description: This extension returns the position as determined by weight.


position1 specifies the first position.


position2 specifies the second position.


weight is a real number, ranging from 0 to 1.


The position is given by:


((1-weight) * position1) + (weight * position2)


Given weight:
Resulting position:


0


position1

1


position2

0.5


The midpoint between position1 and position2.

Example: ; position:interpolate

; Interpolate new positions between

; two given positions.

(position:interpolate (position 3 5 4)


(position 3 3 3) 0)

;; #[position 3 5 4]

(position:interpolate (position 3 5 4)


(position 3 3 3) 1)

;; #[position 3 3 3]

(position:interpolate (position 3 5 4)


(position 3 3 3) 0.5)

;; #[position 3 4 3.5]
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0105.HTM