PolarCoord.fromPoints constructor
Implementation
factory PolarCoord.fromPoints(Point<double> origin, Point<double> point) {
// Subtract the origin from the point to get the vector from the origin
// to the point.
final Point<double> vectorPoint = point - origin;
final Offset vector = Offset(vectorPoint.x, vectorPoint.y);
// The polar coordinate is the angle the vector forms with the x-axis, and
// the distance of the vector.
return PolarCoord(
vector.direction,
vector.distance,
);
}