You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto distance = keisan::Point2::distance_between(a, b);
It's better to move the distance_between and angle_between function to the namespace scope, not in the class scope as a static function. So the function could be simply just be called like this:
auto distance = keisan::distance_between(a, b);
Because how c++ works, it's possible to have multiple function name with different argument type and result type. Hence it's fine to put it on global scope.
Also, sometimes it's also more convenient to just call a distance and a direction equation like this:
auto distance = a.distance_to(b);
That's why it's better to also add function to calculate distance and direction equation between self and other Point. So aside from previously mentioned functions, also add the following function to the Point classes:
Currently the distance and the direction equations in the
Point
classess are as follows:To make the usage simpler, instead of calling:
auto distance = keisan::Point2::distance_between(a, b);
It's better to move the
distance_between
andangle_between
function to the namespace scope, not in the class scope as a static function. So the function could be simply just be called like this:auto distance = keisan::distance_between(a, b);
Because how c++ works, it's possible to have multiple function name with different argument type and result type. Hence it's fine to put it on global scope.
Also, sometimes it's also more convenient to just call a distance and a direction equation like this:
auto distance = a.distance_to(b);
That's why it's better to also add function to calculate distance and direction equation between self and other
Point
. So aside from previously mentioned functions, also add the following function to thePoint
classes:The text was updated successfully, but these errors were encountered: