ihmcrobotics / euclid

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

Create a ConvexPolygon2D from a ConvexPolygon2DReadOnly #43

Open calvertdw opened 3 years ago

calvertdw commented 3 years ago

I am pretty sure an exception is always thrown when trying to create a ConvexPolygon2D from a ConvexPolygon2DReadOnly that has not been updated under the hood. This is problematic since you can't update a ReadOnly one.

Exception in thread "GDXFootstepPlanGraphic-pool-28346-thread-5" us.ihmc.euclid.geometry.exceptions.OutdatedPolygonException: Call the update method before doing any other calculation!
    at us.ihmc.euclid.geometry.interfaces.ConvexPolygon2DReadOnly.checkIfUpToDate(ConvexPolygon2DReadOnly.java:57)
    at us.ihmc.euclid.geometry.interfaces.ConvexPolygon2DReadOnly.getVertex(ConvexPolygon2DReadOnly.java:168)
    at us.ihmc.euclid.geometry.interfaces.ConvexPolygon2DBasics.addVertices(ConvexPolygon2DBasics.java:183)
    at us.ihmc.euclid.geometry.interfaces.ConvexPolygon2DBasics.set(ConvexPolygon2DBasics.java:237)
    at us.ihmc.euclid.geometry.ConvexPolygon2D.<init>(ConvexPolygon2D.java:117)
ConvexPolygon2D updatedFoothold = new ConvexPolygon2D(minimalFootstep.getFoothold());
foothold.set(updatedFoothold);
SylvainBertrand commented 6 months ago

@Richiedu38 let's create a unit-test for this issue