Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>


#define EPSILON 1e-9


#define ALL(x) (x).begin(), (x).end()


class point_t;


class vector_t {
public:
  double x;
  double y;
  double z;
  
public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};
  
  vector_t(const point_t& p);

public:
  double operator[](int i) const {
    return (i == 0) ? x : (i == 1) ? y : z;
  };
  
  double& operator[](int i) {
    return (i == 0) ? x : (i == 1) ? y : z;
  };

public:
  vector_t operator-() const {
    return vector_t(-x, -y, -z);
  };
  
  vector_t operator+(const vector_t& v) const {
    return vector_t(x + v.x, y + v.y, z + v.z);
  };
  
  double operator*(const vector_t& v) const {
    return x * v.x + y * v.y + z * v.z;
  };
  
  vector_t operator*(double a) const {
    return vector_t(x * a, y * a, z * a);
  };
  
  vector_t operator/(double a) const {
    return vector_t(x / a, y / a, z / a);
  };
  
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
    
  vector_t operator-=(const vector_t& v) {
    x -= v.x;
    y -= v.y;
    z -= v.z;
    
    return *this;
  };

public:
  double length() const {
    return sqrt(*this * *this);
  };

  vector_t normal() const {
    return *this / length();
  };
};


class point_t {
public:
  double x;
  double y;
  double z;
  double w;

public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};

  point_t(const vector_t& v) : x(v.x), y(v.y), z(v.z), w(1) {};

public:
  double operator[](int i) const {
    return (i == 0) ? x : (i == 1) ? y : (i == 2) ? z : w;
  };
  
  double& operator[](int i) {
    return (i == 0) ? x : (i == 1) ? y : (i == 2) ? z : w;
  };
  
public:
  point_t operator+(const vector_t& v) const {
    return point_t(x + v.x, y + v.y, z + v.z);
  };

  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };

  point_t operator-() const {
    return point_t(-x, -y, -z, w);
  };

  point_t operator*(double a) const {
    return point_t(x * a, y * a, y * a);
  };

public:
  friend point_t operator*(double a, const point_t& p) {
    return p * a;
  };
};


vector_t::vector_t(const point_t& p) : x(p.x / p.w), y(p.y / p.w), z(p.z / p.w)
{
}


class matrix_t
{
public:
  matrix_t() {
    identitize();
  };
  
public:
  const double* operator[](int i) const {
    return matrix_[i];
  };

  double* operator[](int i) {
    return matrix_[i];
  };

public:
  void identitize() {
    memset(matrix_, 0, sizeof(matrix_));

    matrix_[0][0] =
      matrix_[1][1] =
      matrix_[2][2] =
      matrix_[3][3] = 1;
  };

  void transpose() {
    for (int i = 0; i < 4; i ++)
      for (int j = i + 1; j < 4; j ++)
        if (i != j)
          std::swap(matrix_[i][j], matrix_[j][i]);
  };

public:
  matrix_t operator*(const matrix_t& m) const {
    matrix_t r;

    for (int i = 0; i < 4; i ++)
      for (int j = 0; j < 4; j ++)
        r[i][j] =
          matrix_[i][0] * m[0][j] +
          matrix_[i][1] * m[1][j] +
          matrix_[i][2] * m[2][j] +
          matrix_[i][3] * m[3][j];

    return r;
  };

  vector_t operator*(const vector_t& v) const {
    vector_t r;

    for (int i = 0; i < 3; i ++)
      r[i] =
        matrix_[i][0] * v.x +
        matrix_[i][1] * v.y +
        matrix_[i][2] * v.z +
        matrix_[i][3];
    
    return r;
  };

  point_t operator*(const point_t& p) const {
    point_t r;

    for (int i = 0; i < 4; i ++)
      r[i] =
        matrix_[i][0] * p.x +
        matrix_[i][1] * p.y +
        matrix_[i][2] * p.z +
        matrix_[i][3] * p.w;
    
    return r;
  };

public:
  static matrix_t translation(double x = 0, double y = 0, double z = 0) {
    matrix_t m;

    m[0][3] = x;
    m[1][3] = y;
    m[2][3] = z;

    return m;
  };

  static matrix_t rotation(double theta = 0) {
    matrix_t m;
    
    m[0][0] =  cos(theta);
    m[0][1] = -sin(theta);
    m[1][0] =  sin(theta);
    m[1][1] =  cos(theta);
    
    return m;
  };

  static matrix_t scale(double s = 1) {
    matrix_t m;

    m[0][0] = m[1][1] = m[2][2] = s;

    return m;
  };

private:
  double matrix_[4][4];
};


class ccw_t : public std::unary_function<point_t, bool>
{
public:
  ccw_t(const point_t& p0, const point_t& p1) : p0_(p0), a_(p1 - p0) {};

public:
  bool operator()(const point_t& p) const {
    vector_t b(p - p0_);

    return (a_ ^ b).z > 0;
  };

private:
  point_t p0_;

  vector_t a_;
};


class triangle_area
{
public:
  double operator()(const vector_t& a, const vector_t& b) const {
    return std::abs((a ^ b).z) / 2;
  };

  double operator()(const point_t& p0, const point_t& p1, const point_t& p2) const {
    return (*this)(p1 - p0, p2 - p0);
  };
};


class numeric_predictor : public std::binary_function<double, double, bool>
{
public:
  numeric_predictor(double e = 1e-9) : e_(e) {};

public:
  bool operator()(double a, double b) const {
    return std::abs(a - b) < e_;
  };

private:
  double e_;
};


class angle_comparator : public std::binary_function<point_t, point_t, bool>
{
public:
  bool operator()(const point_t& a, const point_t& b) const {
    return normalize(atan2(a.y, a.x)) < normalize(atan2(b.y, b.x));
  };

private:
  double normalize(double a) const {
    while (a < 0)
      a += 2 * M_PI;

    while (a >= 2 * M_PI)
      a -= 2 * M_PI;

    return a;
  };
};


class extender
{
public:
  std::vector<point_t> operator()(std::vector<point_t> points) const {
    int size = points.size();

    for (int i = 0; i < size; i ++)
      points[i] = matrix_t::rotation(1) * points[i];

    std::vector<double> a(size);

    for (int i = 0; i < size; i ++)
      a[i] = normalize(atan2(points[i].y, points[i].x));

    std::sort(ALL(a));

    a.erase(std::unique(ALL(a), numeric_predictor()), a.end());

    std::vector<point_t> pts;

    for (int i = 0; i < size; i ++) {
      int j = (i + 1) % size;

      vector_t v(points[j] - points[i]);

      pts.push_back(points[i]);

      for (int k = 0; k < a.size(); k ++) {
        double A = tan(a[k]);

        double t = -(points[i].x - points[i].y / A) / (v.x - v.y / A);

        if (EPSILON < t && t < 1 - EPSILON)
          pts.push_back(v * t + points[i]);
      }
    }

    for (int i = 0, size = pts.size(); i < size; i ++)
      pts[i] = matrix_t::rotation(-1) * pts[i];
    
    std::sort(ALL(pts), angle_comparator());

    return pts;
  };

private:
  double normalize(double a) const {
    while (a < 0)
      a += M_PI;

    while (a >= M_PI)
      a -= M_PI;

    return a;
  };
};


class solver
{
public:
  solver(const std::vector<point_t>& points) : points_(points)
  {
  };

public:
  point_t solve() {
    points_ = extender()(points_);

    int N = points_.size();

    for (int i = 0; i < N / 2; i ++) {
      int j = i + N / 2;

      double a = 0, b = 0;

      for (int k = 1; k < N / 2; k ++) {
        b += triangle_area()(point_t(), points_[(i+k) % N], points_[(i+k+1) % N]);
        a += triangle_area()(point_t(), points_[(j+k) % N], points_[(j+k+1) % N]);
      }

      double c, d, e, f;

      c = a + triangle_area()(point_t(), points_[j], points_[(j+1) % N]);
      d = a + triangle_area()(point_t(), points_[i], points_[(i+1) % N]);
      e = b + triangle_area()(point_t(), points_[i], points_[(i+1) % N]);
      f = b + triangle_area()(point_t(), points_[j], points_[(j+1) % N]);

      if (std::abs(d + e - c - f) < EPSILON)
        continue;

      double t = (e - c) / (d + e - c -f);

      if (0 <= t && t <= 1) {
        point_t p((1-t) * points_[i] + t * points_[(i+1) % N]);

        return vector_t(p).normal() * 1.1;
      }
    }

    return vector_t(points_[0]).normal() * 1.1;
  };

private:
  std::vector<point_t> points_;
};


int main(int argc, char** argv)
{
  while (1) {
    int N;

    std::cin >> N;

    if (N == 0)
      break;

    std::vector<point_t> points(N);

    for (int i = 0; i < N; i ++)
      std::cin >> points[i].x >> points[i].y;

    point_t p(solver(points).solve());

    std::cout << std::fixed << std::setprecision(15) << p.x << ' ';
    std::cout << std::fixed << std::setprecision(15) << p.y << std::endl;
  }

  return 0;
}

Compiler output:
a.cc: In member function 'void matrix_t::identitize()':
a.cc:152:5: error: 'memset' was not declared in this scope
  152 |     memset(matrix_, 0, sizeof(matrix_));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <vector>
  +++ |+#include <cstring>
    7 | 
a.cc: At global scope:
a.cc:243:27: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
  243 | class ccw_t : public std::unary_function<point_t, bool>
      |                           ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/iomanip:42,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_function.h:117:12: note: declared here
  117 |     struct unary_function
      |            ^~~~~~~~~~~~~~
a.cc:275:39: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  275 | class numeric_predictor : public std::binary_function<double, double, bool>
      |                                       ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
a.cc:290:38: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  290 | class angle_comparator : public std::binary_function<point_t, point_t, bool>
      |                                      ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~