To find the distance from the point to the straight line:
Double dis (point p1,point p2)
{
if (Fabs (p1.x-p2.x) <exp)//Equal
{
return Fabs (P2.X-PEGX);
}
Else
{
Double k= (P2.Y-P1.Y)/(p2.x-p1.x);
Double b=p2.y-k*p2.x;
return Fabs (k*pegx-pegy+b)/sqrt (k*k+1);//return distance
}
}
Determine whether a polygon is convex
If the hole contains any protrusions (i.e), if there exist any of interior points in the hole so, if connected by a Lin e segment, that segment would cross one or more edges of the hole) (in parentheses is an English description of the definition of a convex polygon), then the Filled-in-hole would isn't be Structurally sound enough to support the peg under normal stress as the furniture are used.
Read the edges sequentially, edges and edges are in one order (the cross product is all positive or all negative)
POJ1584 to determine whether a polygon is convex, and to determine the distance from a point to a straight line