Category: circle

Check if chords of a Circle are symmetric after some rotation

  #include using namespace std;  vector calculateDivisors(int N){    vector div;    for (int i = 1; i * i A[i].second) {            swap(A[i].first, A[i].second);        }        st.insert(A[i]);    }          vector div = calculateDivisors(N);          for (auto x : div) {        bool exist = 1;        for (int i = 0; i < M; i++) {            int dx = (A[i].first + x) % N;            int dy = (A[i].second + x) % N;            if (dx > dy) {                swap(dx, […]

Continue Reading

Length of intercept cut off from a line by a Circle

#include using namespace std;  double radius(int a, int b, int c){            int g = a / 2;    int f = b / 2;          if (g * g + f * f – c < 0)        return (-1);          return (sqrt(g * g + f * f - c));}  double centerDistanceFromLine(int a, int b,                              int i, int j,                              int k){        int g = a / 2;    int f […]

Continue Reading