ihmcrobotics / euclid

Vector math, geometry, reference frame, and shapes 2D & 3D
Apache License 2.0
31 stars 9 forks source link

Calling FrameConvexPolygon2D.setIncludingFrame() doesn't set frame with empty vertex. #16

Closed rjgriffin42 closed 6 years ago

rjgriffin42 commented 6 years ago

The following case current fails:

There are two random polygons, in random frames, polygonA and polygonB.

polygonA.clear();
polygonB.clear();
polygonB.setIncludingFrame(polygonA);
assert(polygonA.epsilonEquals(polygonB, 1e-5);

This fails because of a reference frame mismatch.

rjgriffin42 commented 6 years ago

Note that a way around this is

polygonA.clear();
polygonB.clear();
polygonB.setIncludingFrame(polygonA.getReferenceFrame(), polygonA);
assert(polygonA.epsilonEquals(polygonB, 1e-5);

This isn't exactly a desirable work around, though.

SylvainBertrand commented 6 years ago

Oh wow, I'll fix that, thanks!

SylvainBertrand commented 6 years ago

Addressed in a2ac89557e333494b2358564d604657c19d1cd9b