edist(cclx, ccly, this->cc().lrx(), this->cc().lry()) < rf
&& rf < edist(cclx, ccly, this->cc().rrx(), this->cc().rry())
) {
- // TODO find intersection lrx, lry -> rf -> rrx, rry
+ auto clif = ::intersect(
+ cclx, ccly, rf,
+ this->cc().lrx(), this->cc().lry(),
+ this->cc().rrx(), this->cc().rry()
+ );
+ double xf = std::get<1>(clif);
+ double yf = std::get<2>(clif);
+ if (
+ edist(
+ std::get<3>(clif), std::get<4>(clif),
+ this->cc().x(), this->cc().y()
+
+ )
+ < edist(xf, yf, this->cc().x(), this->cc().y())
+ ) {
+ xf = std::get<3>(clif);
+ yf = std::get<4>(clif);
+ }
// TODO find angle: intersection, ccl, p1
// TODO rotate by such angle
}