/*! Return Euclidean distance to `p`. */
double edist(Point const& p) const;
+ /*! Return length of arc between two points when radius is kwown.
+ *
+ * \see https://math.stackexchange.com/questions/1595872/arclength-between-two-points-on-a-circle-not-knowing-theta
+ */
+ double arc_len(Point const& p, double r);
+
/*! Generate output for plotting with gnuplot. */
void gen_gnuplot_to(std::ostream& out);
return sqrt(pow(p.x() - this->_x, 2.0) + pow(p.y() - this->_y, 2.0));
}
+double
+Point::arc_len(Point const& p, double r)
+{
+ return 2 * r * asin(this->edist(p) / 2 / r);
+}
+
void
Point::gen_gnuplot_to(std::ostream& out)
{