Merge pull request #215 from hannobraun/hash

Derive `Hash` for most math types
This commit is contained in:
Hanno Braun 2022-02-19 11:28:07 +01:00 committed by GitHub
commit 915266438f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@ use parry3d_f64::bounding_volume::BoundingVolume as _;
use super::{Point, Vector};
/// An axis-aligned bounding box (AABB)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
pub struct Aabb<const D: usize> {
/// The minimum coordinates of the AABB
pub min: Point<D>,

View File

@ -12,7 +12,7 @@ use super::{Scalar, Vector};
///
/// The goal of this type is to eventually implement `Eq` and `Hash`, making it
/// easier to work with vectors. This is a work in progress.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
pub struct Point<const D: usize>([Scalar; D]);
impl<const D: usize> Point<D> {

View File

@ -1,7 +1,7 @@
use super::Point;
/// A line segment, defined by its two end points
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
pub struct Segment<const D: usize> {
pub a: Point<D>,
pub b: Point<D>,

View File

@ -1,7 +1,7 @@
use super::Point;
/// A triangle
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
pub struct Triangle {
pub a: Point<3>,
pub b: Point<3>,

View File

@ -12,7 +12,7 @@ use super::Scalar;
///
/// The goal of this type is to eventually implement `Eq` and `Hash`, making it
/// easier to work with vectors. This is a work in progress.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
pub struct Vector<const D: usize>([Scalar; D]);
impl<const D: usize> Vector<D> {