Ejemplo n.º 1
0
 public static double ComputeWallwalkAngle(Point start, Point intersection, Edge wall)
 {
     // Compute the angle needed to turn in order to walk parallel to the wall,
     // with your right hand on it.
     Point heading, end;
     Edge compare;
     end = wall.P1;
     heading = start + end - intersection;
     compare = new Edge(intersection, heading);
     if (compare.CrossProduct(end) > 0)
     {
         end = wall.P2;
         heading = start + end - intersection;
         compare = new Edge(intersection, heading);
     }
     return Math.Atan2(end.Y - intersection.Y, end.X - intersection.X) -
            Math.Atan2(intersection.Y - start.Y, intersection.X - start.X);
 }