Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all Shapes implement PartialEq<Self> #51

Open
dstaatz opened this issue Sep 6, 2021 · 2 comments
Open

Not all Shapes implement PartialEq<Self> #51

dstaatz opened this issue Sep 6, 2021 · 2 comments

Comments

@dstaatz
Copy link
Contributor

dstaatz commented Sep 6, 2021

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
Copy link

RJ commented Aug 30, 2023

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!

@rowanfr
Copy link

rowanfr commented Jan 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants