dimforge/parry

Not all Shapes implement PartialEq<Self>

Opened this issue · 2 comments

As of the 0.7 release:

2D Shapes that implement PartialEq:

  • Ball
  • Cuboid
  • Segment
  • Triangle
  • HalfSpace

2D Shapes that don't implement PartialEq:

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

3D Shapes that implement PartialEq:

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

3D Shapes that don't implement PartialEq:

  • 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
  }
}
RJ commented

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!

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