Remove redundant constructors

Not only are they redundant, they also present a danger of duplicating
those default surfaces.
This commit is contained in:
Hanno Braun 2022-10-11 13:20:49 +02:00
parent 895fff5d8b
commit fe5e0b48d4
2 changed files with 12 additions and 28 deletions

View File

@ -95,7 +95,12 @@ pub use self::{
vertex::{GlobalVertex, SurfaceVertex, Vertex}, vertex::{GlobalVertex, SurfaceVertex, Vertex},
}; };
use crate::storage::{Handle, Store}; use fj_math::Vector;
use crate::{
path::GlobalPath,
storage::{Handle, Store},
};
/// The available object stores /// The available object stores
/// ///
@ -163,9 +168,12 @@ impl Default for Surfaces {
fn default() -> Self { fn default() -> Self {
let store = Store::new(); let store = Store::new();
let xy_plane = store.insert(Surface::xy_plane()); let xy_plane =
let xz_plane = store.insert(Surface::xz_plane()); store.insert(Surface::new(GlobalPath::x_axis(), Vector::unit_y()));
let yz_plane = store.insert(Surface::yz_plane()); 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 { Self {
store, store,

View File

@ -16,30 +16,6 @@ impl Surface {
Self { u, v } 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 /// Construct a plane from 3 points
pub fn plane_from_points(points: [impl Into<Point<3>>; 3]) -> Self { pub fn plane_from_points(points: [impl Into<Point<3>>; 3]) -> Self {
let [a, b, c] = points.map(Into::into); let [a, b, c] = points.map(Into::into);