BSGS icon indicating copy to clipboard operation
BSGS copied to clipboard

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

Open albertobsd opened this issue 3 years ago • 0 comments

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!

albertobsd avatar Apr 13 '21 15:04 albertobsd