parry icon indicating copy to clipboard operation
parry copied to clipboard

Not all Shapes implement PartialEq<Self>

Open dstaatz opened this issue 4 years ago • 2 comments

As of the 0.7 release:

2D Shapes that implement PartialEq<Self>:

  • Ball
  • Cuboid
  • Segment
  • Triangle
  • HalfSpace

2D Shapes that don't implement PartialEq<Self>:

  • Capsule
  • TriMesh
  • Polyline
  • HeightField
  • Compound
  • ConvexPolygon
  • RoundCuboid
  • RoundTriangle
  • RoundConvexPolygon

3D Shapes that implement PartialEq<Self>:

  • Ball
  • Cuboid
  • Segment
  • Triangle
  • HalfSpace
  • ConvexPolyhedron
  • Cylinder
  • Cone

3D Shapes that don't implement PartialEq<Self>:

  • Capsule
  • TriMesh
  • Polyline
  • HeightField
  • Compound
  • RoundCuboid
  • RoundTriangle
  • RoundCylinder
  • RoundCone
  • RoundConvexPolyhedron

I don't understand why some of these shapes don't implement PartialEq<Self>. Is there any particular reason for this?

Compound would be harder because of SharedShape, but the rest mostly seem like they could derive it.

RoundShape could implement it with the following:

impl<S: Shape + PartialEq> PartialEq for RoundShape<S> {
  fn eq(&self, other: &Self) -> bool {
    self.border_radius == other.border_radius && self.base_shape == other.base_shape
  }
}

dstaatz avatar Sep 06 '21 21:09 dstaatz

Can anyone comment on the feasibility of this?

I'm working on rollback networking, and pretty much all my components I need to rollback are PartialEq except my struct Collider(parry::SharedShape).

Is there any reason why SharedShape couldn't be made PartialEq, if I put in the work to impl PartialEq for the remaining shapes, like the RoundShape example above? What are the likely pitfalls?

thanks!

RJ avatar Aug 30 '23 07:08 RJ

Is there any update as to why the PR #162 hasn't been merged?

rowanfr avatar Jan 13 '24 12:01 rowanfr