Skip to main content

Posts

Showing posts from March, 2021

Fencing ( Latitude Longitude )

 Check Lat/Long is Inside/Outside of fencing <?php function onLine($side,$point)  //check whether p is on the line or not {   if ($point['x'] <= max($side['x']['x'], $side['y']['x']) && $point['x'] <= min($side['x']['x'], $side['y']['x']) &&    ($point['y'] <= max($side['x']['y'], $side['y']['y']) && $point['y'] <= min($side['x']['y'], $side['y']['y'])))       return true; return false; } function direction($point1,$point2,$point3) {    $val=($point2['y']-$point1['y'])*($point3['x']-$point2['x'])-($point2['x']-$point1['x'])*($point3['y']-$point2['y']);    if ($val == 0)    return 0; //colinear    else if ($val <0)    return 2;          //anti-clockwise direction    return 1;          //clockwise direction } function...