Skip to content

Commit

Permalink
Merge pull request #283 from hannobraun/derive
Browse files Browse the repository at this point in the history
Derive some more useful traits for various types
  • Loading branch information
hannobraun authored Mar 3, 2022
2 parents dd8a3bd + 9a61caa commit d0df9a0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/kernel/geometry/curves/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::f64::consts::PI;
use crate::math::{Point, Scalar, Transform, Vector};

/// A circle
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Circle {
/// The center point of the circle
pub center: Point<3>,
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/geometry/curves/line.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::math::{Point, Transform, Vector};

/// A line, defined by a point and a vector
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Line {
/// The origin of the line's coordinate system
pub origin: Point<3>,
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/geometry/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use self::{circle::Circle, line::Line};
/// The nomenclature is inspired by Boundary Representation Modelling Techniques
/// by Ian Stroud. "Curve" refers to unbounded one-dimensional geometry, while
/// while edges are bounded portions of curves.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Curve {
/// A circle
Circle(Circle),
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/geometry/surfaces/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
use super::{Curve, Line};

/// A two-dimensional shape
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Surface {
/// A swept curve
Swept(Swept),
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/geometry/surfaces/swept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};

/// A surface that was swept from a curve
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Swept {
/// The curve that this surface was swept from
pub curve: Curve,
Expand Down
6 changes: 3 additions & 3 deletions src/kernel/topology/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
use super::vertices::Vertex;

/// The edges of a shape
#[derive(Clone)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Edges {
/// The cycles that the edges of the shape form
///
Expand Down Expand Up @@ -34,13 +34,13 @@ impl Edges {
/// The end of each edge in the cycle must connect to the beginning of the next
/// edge. The end of the last edge must connect to the beginning of the first
/// one.
#[derive(Clone)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Cycle {
pub edges: Vec<Edge>,
}

/// An edge of a shape
#[derive(Clone, Debug)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Edge {
/// The curve that defines the edge's geometry
///
Expand Down
4 changes: 2 additions & 2 deletions src/kernel/topology/faces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
use super::edges::Edges;

/// The faces of a shape
#[derive(Clone)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Faces(pub Vec<Face>);

impl Faces {
Expand All @@ -34,7 +34,7 @@ impl Faces {
}

/// A face of a shape
#[derive(Clone)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Face {
/// A face of a shape
///
Expand Down

0 comments on commit d0df9a0

Please sign in to comment.