This documentation is automatically generated by online-judge-tools/verification-helper
// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/CGL_7_B
// verification-helper: ERROR 0.000001
#include "src/real-geometry/circle-lib/inscribed-circle.hpp"
#include "src/real-geometry/class/circle.hpp"
#include "src/real-geometry/utility/io-set.hpp"
#include <iostream>
int main() {
using R = long double;
geometry::point<R> a, b, c;
std::cin >> a >> b >> c;
geometry::circle<R> cir = geometry::inscribed_circle(a, b, c);
std::cout << cir.o.x() << " " << cir.o.y() << " " << cir.r << std::endl;
}
#line 1 "test/aoj/cgl/7_B.test.cpp"
// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/CGL_7_B
// verification-helper: ERROR 0.000001
#line 2 "src/real-geometry/circle-lib/inscribed-circle.hpp"
#line 2 "src/real-geometry/class/circle.hpp"
#line 2 "src/real-geometry/class/point.hpp"
#line 2 "src/real-geometry/class/vector.hpp"
#include <complex>
#include <iostream>
namespace geometry {
template< typename R >
class vec2d : public std::complex< R > {
using complex = std::complex< R >;
public:
using complex::complex;
vec2d(const complex &c): complex::complex(c) {}
const R x() const { return this->real(); }
const R y() const { return this->imag(); }
friend vec2d operator*(const vec2d &v, const R &k) {
return vec2d(v.x() * k, v.y() * k);
}
friend vec2d operator*(const R &k, const vec2d &v) {
return vec2d(v.x() * k, v.y() * k);
}
friend std::istream &operator>>(std::istream &is, vec2d &v) {
R x, y;
is >> x >> y;
v = vec2d(x, y);
return is;
}
};
}
#line 4 "src/real-geometry/class/point.hpp"
#include <vector>
namespace geometry {
template< typename R >
using point = vec2d<R>;
template< typename R >
using points = std::vector< point< R > >;
}
#line 4 "src/real-geometry/class/circle.hpp"
#line 6 "src/real-geometry/class/circle.hpp"
// circle
namespace geometry {
template< typename R >
class circle {
public:
point<R> o;
R r;
circle() = default;
circle(point<R> o, R r) : o(o), r(r) {}
const point<R> center() const {
return o;
}
const R radius() const {
return r;
}
};
template< typename R >
using circles = std::vector< circle<R> >;
}
#line 2 "src/real-geometry/distance/distance-sp.hpp"
#line 2 "src/real-geometry/class/segment.hpp"
#line 2 "src/real-geometry/utility/equals/vector.hpp"
#line 2 "src/real-geometry/utility/equals/real-number.hpp"
#line 2 "src/real-geometry/utility/sign.hpp"
#line 2 "src/real-geometry/common/const/eps.hpp"
#line 2 "src/real-geometry/common/float-alias.hpp"
namespace geometry {
using f80 = long double;
using f64 = double;
}
#line 4 "src/real-geometry/common/const/eps.hpp"
namespace geometry {
inline static f80 &eps() {
static f80 EPS = 1e-10;
return EPS;
}
void set_eps(f80 EPS) {
eps() = EPS;
}
}
#line 2 "src/real-geometry/numbers/sign.hpp"
#line 2 "src/real-geometry/common/int-alias.hpp"
namespace geometry {
using i32 = int;
using i64 = long long;
}
#line 4 "src/real-geometry/numbers/sign.hpp"
namespace geometry::number::sign {
constexpr i32 PLUS = +1;
constexpr i32 ZERO = 0;
constexpr i32 MINUS = -1;
}
#line 5 "src/real-geometry/utility/sign.hpp"
namespace geometry {
using namespace geometry::number::sign;
template< typename R >
inline int sign(R r) {
if (r < -eps()) return MINUS;
if (r > +eps()) return PLUS;
return ZERO;
}
}
#line 4 "src/real-geometry/utility/equals/real-number.hpp"
namespace geometry {
template< typename R >
bool equals(R a, R b) {
return sign(a - b) == 0;
}
}
#line 5 "src/real-geometry/utility/equals/vector.hpp"
namespace geometry {
template< typename R >
bool equals(const vec2d<R> &a, const vec2d<R> &b) {
return equals(a.x(), b.x()) and equals(a.y(), b.y());
}
}
#line 5 "src/real-geometry/class/segment.hpp"
#include <cassert>
#line 8 "src/real-geometry/class/segment.hpp"
namespace geometry {
template< typename R >
class segment {
public:
point<R> a, b;
segment() = default;
segment(point<R> a, point<R> b) : a(a), b(b) {
assert(not equals(a, b));
}
};
template< typename R >
using segments = std::vector< segment<R> >;
}
#line 2 "src/real-geometry/mapping/projection.hpp"
#line 2 "src/real-geometry/class/line.hpp"
#line 5 "src/real-geometry/class/line.hpp"
#line 8 "src/real-geometry/class/line.hpp"
namespace geometry {
template< typename R >
class line {
using P = point<R>;
public:
P a, b;
line() = default;
line(P a, P b) : a(a), b(b) {
assert(not equals(a, b));
}
};
template< typename R >
using lines = std::vector< line<R> >;
}
#line 2 "src/real-geometry/operation/inner-product.hpp"
#line 4 "src/real-geometry/operation/inner-product.hpp"
namespace geometry {
template< typename R >
R inner_product(const vec2d<R> &a, const vec2d<R> &b) {
return a.x() * b.x() + a.y() * b.y();
}
}
#line 6 "src/real-geometry/mapping/projection.hpp"
#line 8 "src/real-geometry/mapping/projection.hpp"
namespace geometry {
template< typename R >
point<R> projection(const line<R> &l, const point<R> &p) {
R t = inner_product<R>(p - l.a, l.a - l.b) / std::norm(l.a - l.b);
return l.a + (l.a - l.b) * t;
}
}
#line 2 "src/real-geometry/operation/ccw.hpp"
#line 2 "src/real-geometry/numbers/ccw.hpp"
namespace geometry::number::ccw {
constexpr int COUNTER_CLOCKWISE = +1;
constexpr int CLOCKWISE = -1;
constexpr int ONLINE_BACK = +2; // c-a-b
constexpr int ONLINE_FRONT = -2; // a-b-c
constexpr int ON_SEGMENT = 0; // a-c-b
}
#line 2 "src/real-geometry/operation/cross-product.hpp"
#line 4 "src/real-geometry/operation/cross-product.hpp"
namespace geometry {
template< typename R >
R cross_product(const vec2d<R> &a, const vec2d<R> &b) {
return a.x() * b.y() - a.y() * b.x();
}
}
#line 8 "src/real-geometry/operation/ccw.hpp"
namespace geometry {
using namespace geometry::number::ccw;
template< typename R >
int ccw(const point<R> &a, point<R> b, point<R> c) {
b = b - a, c = c - a;
if (sign(cross_product(b, c)) == +1) return COUNTER_CLOCKWISE;
if (sign(cross_product(b, c)) == -1) return CLOCKWISE;
if (sign(inner_product(b, c)) == -1) return ONLINE_BACK;
if (std::norm(b) < std::norm(c)) return ONLINE_FRONT;
return ON_SEGMENT;
}
}
#line 7 "src/real-geometry/distance/distance-sp.hpp"
#line 9 "src/real-geometry/distance/distance-sp.hpp"
#include <algorithm>
namespace geometry {
template< typename R >
R distance_sp(const segment<R> &s, const point<R> &p) {
point<R> pr = projection({s.a, s.b}, p);
if (ccw(s.a, s.b, pr) == 0) return std::abs(pr - p);
return std::min(std::abs(s.a - p), std::abs(s.b - p));
}
}
#line 6 "src/real-geometry/circle-lib/inscribed-circle.hpp"
#line 8 "src/real-geometry/circle-lib/inscribed-circle.hpp"
namespace geometry {
template< typename R >
circle<R> inscribed_circle(const point<R> &a, const point<R> &b, const point<R> &c) {
R A = std::abs(b - c), B = std::abs(c - a), C = std::abs(a - b);
point<R> o((a * A + b * B + c * C) / (A + B + C));
R r = distance_sp({a, b}, o);
return {o, r};
}
}
#line 2 "src/real-geometry/utility/io-set.hpp"
#include <iomanip>
namespace geometry {
class IoSetup {
using u32 = unsigned int;
void set(std::ostream &os, u32 precision) {
os << std::fixed << std::setprecision(precision);
}
public:
IoSetup(u32 precision = 15) {
std::cin.tie(0);
std::ios::sync_with_stdio(0);
set(std::cout, precision);
set(std::cerr, precision);
}
} iosetup;
}
#line 7 "test/aoj/cgl/7_B.test.cpp"
#line 9 "test/aoj/cgl/7_B.test.cpp"
int main() {
using R = long double;
geometry::point<R> a, b, c;
std::cin >> a >> b >> c;
geometry::circle<R> cir = geometry::inscribed_circle(a, b, c);
std::cout << cir.o.x() << " " << cir.o.y() << " " << cir.r << std::endl;
}