Skip to content

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

Description

@albertobsd

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions