Length of Union of Segments of A Line: Lines
Length of Union of Segments of A Line: Lines
Triangle :
Check whether a given point lies inside a triangle or not
Rectangle | Square | Circle :
Pizza cut problem (Or Circle Division by Lines)
Maximum points that can be enclosed in a circle of
given radius
Check if a line touches or intersects a circle
Check whether given circle resides in boundary
maintained by two other circles
Minimum circle problem
How to check if two given line segments intersect?
// A C++ program to check if two given line segments intersect
#include <iostream>
using namespace std;
struct Point
{
int x;
int y;
};
return false;
}
// General case
if (o1 != o2 && o3 != o4)
return true;
// Special Cases
// p1, q1 and p2 are colinear and p2 lies on segment p1q1
if (o1 == 0 && onSegment(p1, p2, q1)) return true;
doIntersect(p1, q1, p2, q2)? cout << "Yes\n": cout << "No\n";
return 0;
}
int maxPoint = 0;
int curMax, overlapPoints, verticalPoints;
else
{
int yDif = points[j].second - points[i].second;
int xDif = points[j].first - points[i].first;
int g = __gcd(xDif, yDif);
return maxPoint;
}
// Driver code
int main()
{
const int N = 6;
int arr[N][2] = {{-1, 1}, {0, 0}, {1, 1}, {2, 2},
{3, 3}, {3, 4}};
return 0;
}
if (sign)
return make_pair(-abs(dy) / g, abs(dx) / g);
else
return make_pair(abs(dy) / g, abs(dx) / g);
}
return minLines;
}
return jumps;
}
line lines[3];
lines[0] = line(1, 0, 0);
lines[1] = line(0, 1, 0);
lines[2] = line(1, 1, -2);
return 0;
}
/* A function to check whether point P(x, y) lies inside the triangle formed
by A(x1, y1), B(x2, y2) and C(x3, y3) */
bool isInside(int x1, int y1, int x2, int y2, int x3, int y3, int x, int y)
{
/* Calculate area of triangle ABC */
float A = area (x1, y1, x2, y2, x3, y3);
return 0;
}
// Driver code
int main()
{
cout << findMaximumPieces(3);
return 0;
}
Point arr[MAX_POINTS];
double dis[MAX_POINTS][MAX_POINTS];
// exit angle
else
count--;
return res;
}
return ans;
}
// Driver code
int main()
{
Point arr[] = {Point(6.47634, 7.69628),
Point(5.16828, 4.79915),
Point(6.69533, 6.20378)};
int r = 1;
int n = sizeof(arr)/sizeof(arr[0]);
return 0;
}
// Driven Program
int main()
{
int radius = 5;
int x = 0, y = 0;
int a = 3, b = 4, c = 25;
checkCollision(a, b, c, x, y, radius);
return 0;
}
// driver program
int main()
{
// Radius of outer circle and inner circle
// respectively
int R = 8, r = 4;
}
inline bool lt(const dbl & x, const dbl & y){
struct pt{
dbl x, y;
pt(){}
};
int n;
pt p[N];
dbl b = -2 * p[i].x;
dbl D = b * b - 4 * c;
if(lt(D, 0))
return false;
D = safe_sqrt(D);
l = max(l, x1);
r = min(r, x2);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
int x, y;
return 0;
}
if(has_negative){
p[i].y = -p[i].y;
dbl L = 0, R = 1e16;
if(can(1)){
R = 1;
else{
L = 1;
if(can(mid))
R = mid;
else
L = mid;
cout.precision(16);