Coords.php:
[fledgeling.git] / UniSim.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
 
require_once("SpaceNode.php");
require_once("Coords.php");
 
$universe = new SpaceNode("universe node", 0, new SphericalCoords(0,0,0), null);
echo $universe->describe();
 
$node1 = new SpaceNode("node1", 40, new LinearCoords(40), $universe);
 
$infra_list = $universe->get_infra_list();
foreach ($infra_list as $infra) {
        echo $infra->describe();
}
echo $universe->describe();
 
$vector1 = new SphericalCoords(5, M_PI/4, M_PI/8);
printf("Vector1: %s\n", $vector1->string());
$vector2 = new CartesianCoords(7, 6, 5);
printf("Vector2: %s\n", $vector2->string());
$vector3 = $vector1->vector_add($vector2);
printf("Vector3 = Vector1 + Vector2: %s\n", $vector3->string());
$vector4 = $vector2->vector_add($vector1);
printf("Vector4 = Vector2 + Vector1: %s\n", $vector4->string());
$vector5 = $vector1->vector_subtract($vector2);
printf("Vector5 = Vector1 - Vector2: %s\n", $vector5->string());
$vector6 = $vector2->vector_subtract($vector1);
printf("Vector6 = Vector2 - Vector1: %s\n", $vector6->string());
 
?>