Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Distance and Direction Equations #34

Closed
threeal opened this issue May 7, 2021 · 0 comments · Fixed by #46
Closed

Modify Distance and Direction Equations #34

threeal opened this issue May 7, 2021 · 0 comments · Fixed by #46
Assignees
Labels
enhancement New feature or request
Projects
Milestone

Comments

@threeal
Copy link
Member

threeal commented May 7, 2021

Currently the distance and the direction equations in the Point classess are as follows:

static double distance_between(const Point & point_a, const Point & point_b);
static double angle_between(const Point & point_a, const Point & point_b);

double magnitude() const;
double direction() const;

To make the usage simpler, instead of calling:

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:

double distance_to(const Point & point);
double direction_to(const Point & point);
@threeal threeal added the enhancement New feature or request label May 7, 2021
@threeal threeal added this to To do in Keisan via automation May 7, 2021
@threeal threeal added this to the First Major Release milestone May 7, 2021
@threeal threeal self-assigned this Jun 23, 2021
Keisan automation moved this from To do to Done Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Keisan
  
Done
Development

Successfully merging a pull request may close this issue.

1 participant