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

Point::equals is not always true if you using Point::Set #13

Open
albertobsd opened this issue Apr 13, 2021 · 0 comments
Open

Point::equals is not always true if you using Point::Set #13

albertobsd opened this issue Apr 13, 2021 · 0 comments

Comments

@albertobsd
Copy link

I been testing this funtion in my keyhunt tool, and some times i get a wrong result, this is because sometimes you are working adding points in a blind way, and you need test if some point is equals to other to performe a DoubleDirect instead of AddDirect

set work in this way, set x and y but not z

void Point::Set(Point &p) {
  x.Set(&p.x);
  y.Set(&p.y);
}

and equals evaluate the 3 elements, x,y and z

bool Point::equals(Point &p) {
  return x.IsEqual(&p.x) && y.IsEqual(&p.y) && z.IsEqual(&p.z);
}

To solve this when you are working you have 2 ways to to that, perform Double direct outside of the cycle or change the Point::set funtion to set also the z Integer in the next way:

void Point::Set(Point &p) {
  x.Set(&p.x);
  y.Set(&p.y);
  z.Set(&p.z);
}

Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant