Commit | Line | Data |
---|---|---|
e586807d H |
1 | <?php |
2 | function smarty_function_circle_coordinates($params, &$smarty) | |
3 | { | |
4 | $center_x=$params['center_x']; | |
5 | if (!$center_x) $center_x=280; | |
6 | $center_y=$params['center_y']; | |
7 | if (!$center_y) $center_y=280; | |
8 | $radius=$params['radius']; | |
9 | if (!$radius) $radius=23; | |
10 | // echo $center_y; | |
11 | // echo $center_x; | |
12 | // echo "<BR>"; | |
13 | $amount=$params['amount']; | |
14 | $iteration=$params['iteration']; | |
15 | ||
16 | $deg=(360/$amount); | |
17 | $deg*=$iteration; | |
18 | ||
19 | $sin=sin(deg2rad($deg)); | |
20 | $cos=cos(deg2rad($deg)); | |
21 | $x_coordinate=$center_x+(($radius)*$cos); | |
22 | $y_coordinate=$center_y+(($radius)*$sin); | |
23 | ||
24 | $smarty->assign('x_coordinate',(int)$x_coordinate); | |
25 | $smarty->assign('y_coordinate',(int)$y_coordinate); | |
26 | } | |
27 | ||
28 | ||
29 | ?> |