Skip to content

Commit

Permalink
Remove redundant constructors
Browse files Browse the repository at this point in the history
Not only are they redundant, they also present a danger of duplicating
those default surfaces.
  • Loading branch information
hannobraun committed Oct 11, 2022
1 parent 895fff5 commit fe5e0b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
16 changes: 12 additions & 4 deletions crates/fj-kernel/src/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ pub use self::{
vertex::{GlobalVertex, SurfaceVertex, Vertex},
};

use crate::storage::{Handle, Store};
use fj_math::Vector;

use crate::{
path::GlobalPath,
storage::{Handle, Store},
};

/// The available object stores
///
Expand Down Expand Up @@ -163,9 +168,12 @@ impl Default for Surfaces {
fn default() -> Self {
let store = Store::new();

let xy_plane = store.insert(Surface::xy_plane());
let xz_plane = store.insert(Surface::xz_plane());
let yz_plane = store.insert(Surface::yz_plane());
let xy_plane =
store.insert(Surface::new(GlobalPath::x_axis(), Vector::unit_y()));
let xz_plane =
store.insert(Surface::new(GlobalPath::x_axis(), Vector::unit_z()));
let yz_plane =
store.insert(Surface::new(GlobalPath::y_axis(), Vector::unit_z()));

Self {
store,
Expand Down
24 changes: 0 additions & 24 deletions crates/fj-kernel/src/objects/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,6 @@ impl Surface {
Self { u, v }
}

/// Construct a `Surface` that represents the xy-plane
pub fn xy_plane() -> Self {
Self {
u: GlobalPath::x_axis(),
v: Vector::unit_y(),
}
}

/// Construct a `Surface` that represents the xz-plane
pub fn xz_plane() -> Self {
Self {
u: GlobalPath::x_axis(),
v: Vector::unit_z(),
}
}

/// Construct a `Surface` that represents the yz-plane
pub fn yz_plane() -> Self {
Self {
u: GlobalPath::y_axis(),
v: Vector::unit_z(),
}
}

/// Construct a plane from 3 points
pub fn plane_from_points(points: [impl Into<Point<3>>; 3]) -> Self {
let [a, b, c] = points.map(Into::into);
Expand Down

0 comments on commit fe5e0b4

Please sign in to comment.