Geometry is one of the most important things in programming. All the ICPC contest there at least one problem is selected from geometry.
the primary things ,
(i) Declaring Point.
you can find the distance between two point by euclidians formula that is
the primary things ,
(i) Declaring Point.
(ii) Declaring Line. (i) Declaring Point.
struct point
{
int x; // here may use double if float type variable you need.
int y;
};
vector<point >p ; // p is point type variable. here you can use point p;
you can find the distance between two point by euclidians formula that is
R = sqrt((x1-x2)*(x1-x2) +(y1-y2)*(y1-y2)) ;
you can use by coding like that
void distance(point a, point b)
{
return sqrt((a.x-b.x)*(a.x-b.x) +(a.y-b.y)*(a.y-b.y)) ;
}
No comments:
Post a Comment