Алгоритм расчета координат для редактора - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Алгоритм расчета координат для редактора.php
- <?php
- $coefficient = 200;
- $levels = [
- 0 => [
- "sector_id" => 61,
- "name" => "Parter 1",
- "position" => [
- "radius"=> 0,
- "x" => 0,
- "y"=> 0
- ],
- "controlPoints" => [
- [
- "radius" => 0,
- "x" => 198,
- "y" => 120
- ],
- [
- "radius" => 0,
- "x" => 198,
- "y" => 173
- ],
- [
- "radius" => 0,
- "x" => 198,
- "y" => 227
- ],
- [
- "radius" => 0,
- "x" => 198,
- "y" => 281
- ],
- [
- "radius" => 0,
- "x" => 216,
- "y" => 281
- ],
- [
- "radius" => 0,
- "x" => 235,
- "y" => 281
- ],
- [
- "radius" => 0,
- "x" => 254,
- "y" => 282
- ],
- [
- "radius" => 0,
- "x" => 254,
- "y" => 120
- ],
- [
- "radius" => 0,
- "x" => 198,
- "y" => 120
- ],
- [
- "radius" => 0,
- "x" => 198,
- "y" => 120
- ]
- ],
- ],
- 1 => [
- "sector_id" => 68,
- "name" => "Balkon 2 top",
- "position" => [
- "radius"=> 0,
- "x" => 0,
- "y"=> 0
- ],
- "controlPoints" => [
- [
- "radius" => 0,
- "x" => 240,
- "y" => 76
- ],
- [
- "radius" => 0,
- "x" => 240,
- "y" => 80
- ],
- [
- "radius" => 0,
- "x" => 240,
- "y" => 83
- ],
- [
- "radius" => 0,
- "x" => 240,
- "y" => 86
- ],
- [
- "radius" => 0,
- "x" => 266,
- "y" => 86
- ],
- [
- "radius" => 0,
- "x" => 291,
- "y" => 86
- ],
- [
- "radius" => 0,
- "x" => 317,
- "y" => 86
- ],
- [
- "radius" => 0,
- "x" => 317,
- "y" => 76
- ],
- [
- "radius" => 0,
- "x" => 240,
- "y" => 76
- ],
- [
- "radius" => 0,
- "x" => 240,
- "y" => 76
- ]
- ],
- ],
- 2 => [
- "sector_id" => 79,
- "name" => "Balkon 3 S2",
- "position" => [
- "radius"=> 0,
- "x" => 0,
- "y"=> 0
- ],
- "controlPoints" => [
- [
- "radius" => 0,
- "x" => 384,
- "y" => 389
- ],
- [
- "radius" => 0,
- "x" => 341,
- "y" => 357
- ],
- [
- "radius" => 0,
- "x" => 382,
- "y" => 300
- ],
- [
- "radius" => 0,
- "x" => 426,
- "y" => 331
- ],
- ],
- ],
- ];
- $places = [
- 0 => [
- "additional_properties" => [
- "row" => "1",
- "place_name" => "1",
- "place_count" => 1,
- "price_type" => 1,
- "sector_id" => 63
- ],
- "position" => [
- "radius" => 0,
- "x" => 40,
- "y" => 40
- ],
- ],
- 1 => [
- "additional_properties" => [
- "row" => "1",
- "place_name" => "2",
- "place_count" => 1,
- "price_type" => 1,
- "sector_id" => 63
- ],
- "position" => [
- "radius" => 0,
- "x" => 60,
- "y" => 40
- ],
- ],
- 2 => [
- "additional_properties" => [
- "row" => "1",
- "place_name" => "3",
- "place_count" => 1,
- "price_type" => 1,
- "sector_id" => 63
- ],
- "position" => [
- "radius" => 0,
- "x" => 80,
- "y" => 40
- ],
- ],
- 3 => [
- "additional_properties" => [
- "row" => "1",
- "place_name" => "4",
- "place_count" => 1,
- "price_type" => 1,
- "sector_id" => 63
- ],
- "position" => [
- "radius" => 0,
- "x" => 100,
- "y" => 40
- ],
- ],
- 4 => [
- "additional_properties" => [
- "row" => "1",
- "place_name" => "5",
- "place_count" => 1,
- "price_type" => 1,
- "sector_id" => 63
- ],
- "position" => [
- "radius" => 0,
- "x" => 120,
- "y" => 40
- ],
- ],
- ];