The default evolution from the start to the end parameters of an object
is linear, i.e.
$value = $start + $t*($end - $start)where $t evolves uniformly from 0 to 1 during the active interval of an object. However, aximate allows you to modify this evolution by specifying the function of $t according to which a certain option should evolve. This is done by providing a second (referenced) hash to the object. For example, a jumping ball can be represented as: point({"coordinates" => [[-100,-50],[0,100]], "interval" => [0,50]}, {"coordinates" => ['$t','(1-$t)**2']}); point({"coordinates" => [[0,100],[100,-50]], "interval" => [50,100]}, {"coordinates" => ['$t','$t**2']}); |
|
... or, with a do-loop ...
$num = 10; $norm = 0; foreach $i (1..$num) { $norm += 1/sqrt(2**$i); } $bound1 = 0; $bound2 = 0; foreach $i (1..$num) { $bound2 += 100/$norm/sqrt(2**$i); $bound3 = $bound1 + 100/$norm/sqrt(2**$i)/2; point({"coordinates" => [[0,-50],[0,100/2**($i-1)-50]], "interval" => [$bound1,$bound3]}, {"coordinates" => ['$t','(1-$t)**2']}); point({"coordinates" => [[0,100/2**($i-1)-50],[0,-50]], "interval" => [$bound3,$bound2]}, {"coordinates" => ['$t','$t**2']}); $bound1 = $bound2; } } |
|
A few remarks: let us assume that f($t) is the evolution
function.
point({"coordinates" => [[],[]]}, {"coordinates" => ['100*cos(2*pi*$t)','100*sin(2*pi*$t)']});NB: Note that the same result can be achieved through point({"coordinates" => [[0,0]], "polar" => [[100,0],[100,360]]}) |