mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-06 08:17:23 +00:00
Merge pull request #215 from hannobraun/hash
Derive `Hash` for most math types
This commit is contained in:
commit
915266438f
@ -3,7 +3,7 @@ use parry3d_f64::bounding_volume::BoundingVolume as _;
|
|||||||
use super::{Point, Vector};
|
use super::{Point, Vector};
|
||||||
|
|
||||||
/// An axis-aligned bounding box (AABB)
|
/// 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> {
|
pub struct Aabb<const D: usize> {
|
||||||
/// The minimum coordinates of the AABB
|
/// The minimum coordinates of the AABB
|
||||||
pub min: Point<D>,
|
pub min: Point<D>,
|
||||||
|
@ -12,7 +12,7 @@ use super::{Scalar, Vector};
|
|||||||
///
|
///
|
||||||
/// The goal of this type is to eventually implement `Eq` and `Hash`, making it
|
/// 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.
|
/// 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]);
|
pub struct Point<const D: usize>([Scalar; D]);
|
||||||
|
|
||||||
impl<const D: usize> Point<D> {
|
impl<const D: usize> Point<D> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::Point;
|
use super::Point;
|
||||||
|
|
||||||
/// A line segment, defined by its two end points
|
/// 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 struct Segment<const D: usize> {
|
||||||
pub a: Point<D>,
|
pub a: Point<D>,
|
||||||
pub b: Point<D>,
|
pub b: Point<D>,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::Point;
|
use super::Point;
|
||||||
|
|
||||||
/// A triangle
|
/// A triangle
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
|
||||||
pub struct Triangle {
|
pub struct Triangle {
|
||||||
pub a: Point<3>,
|
pub a: Point<3>,
|
||||||
pub b: Point<3>,
|
pub b: Point<3>,
|
||||||
|
@ -12,7 +12,7 @@ use super::Scalar;
|
|||||||
///
|
///
|
||||||
/// The goal of this type is to eventually implement `Eq` and `Hash`, making it
|
/// 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.
|
/// 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]);
|
pub struct Vector<const D: usize>([Scalar; D]);
|
||||||
|
|
||||||
impl<const D: usize> Vector<D> {
|
impl<const D: usize> Vector<D> {
|
||||||
|
Loading…
Reference in New Issue
Block a user