Move operation module to top-level

This commit is contained in:
Hanno Braun 2025-02-13 19:01:14 +01:00
parent 891b004592
commit 76f38fbc9a
18 changed files with 37 additions and 30 deletions

View File

@ -8,7 +8,7 @@ use winit::{
window::{Window, WindowAttributes, WindowId}, window::{Window, WindowAttributes, WindowId},
}; };
use crate::{geometry::HandleAny, render::Renderer, view::OperationView}; use crate::{operation::HandleAny, render::Renderer, view::OperationView};
pub fn run(shape: HandleAny) -> anyhow::Result<()> { pub fn run(shape: HandleAny) -> anyhow::Result<()> {
let view = OperationView::new(shape); let view = OperationView::new(shape);

View File

@ -1,6 +1,6 @@
use std::{collections::BTreeMap, fs::File}; use std::{collections::BTreeMap, fs::File};
use crate::geometry::Operation; use crate::operation::Operation;
pub fn export(op: &dyn Operation) -> anyhow::Result<()> { pub fn export(op: &dyn Operation) -> anyhow::Result<()> {
let tri_mesh = op.tri_mesh(); let tri_mesh = op.tri_mesh();

View File

@ -1,11 +1,5 @@
mod operation;
mod sketch; mod sketch;
mod tri_mesh; mod tri_mesh;
mod triangle; mod triangle;
pub use self::{ pub use self::{sketch::Sketch, tri_mesh::TriMesh, triangle::Triangle};
operation::{Handle, HandleAny, Operation, OperationOutput},
sketch::Sketch,
tri_mesh::TriMesh,
triangle::Triangle,
};

View File

@ -1,10 +1,9 @@
use crate::{ use crate::{
math::{Plane, Point}, math::{Plane, Point},
operation::Handle,
topology::{face::Face, vertex::Vertex}, topology::{face::Face, vertex::Vertex},
}; };
use super::Handle;
pub struct Sketch { pub struct Sketch {
pub points: Vec<Point<2>>, pub points: Vec<Point<2>>,
} }

View File

@ -1,12 +1,12 @@
use std::fmt; use std::fmt;
use crate::math::Point; use crate::{
math::Point,
use super::{ operation::{HandleAny, Operation, OperationOutput},
operation::{HandleAny, OperationOutput},
Operation, TriMesh,
}; };
use super::TriMesh;
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Triangle { pub struct Triangle {
pub points: [Point<3>; 3], pub points: [Point<3>; 3],

View File

@ -5,6 +5,7 @@ mod export;
mod geometry; mod geometry;
mod math; mod math;
mod model; mod model;
mod operation;
mod render; mod render;
mod topology; mod topology;
mod view; mod view;

View File

@ -1,6 +1,7 @@
use crate::{ use crate::{
geometry::{Handle, HandleAny, Sketch}, geometry::Sketch,
math::{Bivector, Plane, Point, Vector}, math::{Bivector, Plane, Point, Vector},
operation::{Handle, HandleAny},
topology::sweep::SweepExt, topology::sweep::SweepExt,
}; };

View File

@ -1,6 +1,6 @@
use std::{cmp::Ordering, fmt, rc::Rc}; use std::{cmp::Ordering, fmt, rc::Rc};
use super::tri_mesh::TriMesh; use crate::geometry::TriMesh;
pub trait Operation { pub trait Operation {
fn display(&self, f: &mut fmt::Formatter) -> fmt::Result; fn display(&self, f: &mut fmt::Formatter) -> fmt::Result;

View File

@ -1,7 +1,7 @@
use glam::Vec3; use glam::Vec3;
use wgpu::util::DeviceExt; use wgpu::util::DeviceExt;
use crate::geometry::Operation; use crate::operation::Operation;
use super::vertex::Vertex; use super::vertex::Vertex;

View File

@ -1,6 +1,6 @@
use std::fmt::Write; use std::fmt::Write;
use crate::{geometry::Operation, view::OperationView}; use crate::{operation::Operation, view::OperationView};
pub struct TextRenderer { pub struct TextRenderer {
text_atlas: glyphon::TextAtlas, text_atlas: glyphon::TextAtlas,

View File

@ -1,8 +1,9 @@
use std::fmt; use std::fmt;
use crate::{ use crate::{
geometry::{Handle, HandleAny, Operation, OperationOutput, TriMesh}, geometry::TriMesh,
math::Plane, math::Plane,
operation::{Handle, HandleAny, Operation, OperationOutput},
}; };
use super::{face::Face, solid::Solid}; use super::{face::Face, solid::Solid};

View File

@ -4,10 +4,9 @@ use itertools::Itertools;
use spade::Triangulation; use spade::Triangulation;
use crate::{ use crate::{
geometry::{ geometry::{TriMesh, Triangle},
Handle, HandleAny, Operation, OperationOutput, TriMesh, Triangle,
},
math::{Plane, Point}, math::{Plane, Point},
operation::{Handle, HandleAny, Operation, OperationOutput},
}; };
use super::vertex::Vertex; use super::vertex::Vertex;

View File

@ -1,6 +1,9 @@
use std::fmt; use std::fmt;
use crate::geometry::{Handle, HandleAny, Operation, OperationOutput, TriMesh}; use crate::{
geometry::TriMesh,
operation::{Handle, HandleAny, Operation, OperationOutput},
};
use super::face::Face; use super::face::Face;

View File

@ -1,6 +1,9 @@
use std::fmt; use std::fmt;
use crate::geometry::{Handle, HandleAny, Operation, OperationOutput, TriMesh}; use crate::{
geometry::TriMesh,
operation::{Handle, HandleAny, Operation, OperationOutput},
};
use super::face::Face; use super::face::Face;

View File

@ -1,8 +1,9 @@
use std::fmt; use std::fmt;
use crate::{ use crate::{
geometry::{Handle, HandleAny, Operation, OperationOutput, TriMesh}, geometry::TriMesh,
math::Vector, math::Vector,
operation::{Handle, HandleAny, Operation, OperationOutput},
}; };
use super::{ use super::{

View File

@ -1,8 +1,9 @@
use std::fmt; use std::fmt;
use crate::{ use crate::{
geometry::{Handle, HandleAny, Operation, OperationOutput, TriMesh}, geometry::TriMesh,
math::Vector, math::Vector,
operation::{Handle, HandleAny, Operation, OperationOutput},
}; };
use super::face::Face; use super::face::Face;

View File

@ -1,8 +1,9 @@
use std::fmt; use std::fmt;
use crate::{ use crate::{
geometry::{HandleAny, Operation, OperationOutput, TriMesh}, geometry::TriMesh,
math::{Point, Vector}, math::{Point, Vector},
operation::{HandleAny, Operation, OperationOutput},
}; };
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]

View File

@ -1,6 +1,9 @@
use std::{fmt, iter}; use std::{fmt, iter};
use crate::geometry::{HandleAny, Operation, OperationOutput, TriMesh}; use crate::{
geometry::TriMesh,
operation::{HandleAny, Operation, OperationOutput},
};
#[derive(Clone)] #[derive(Clone)]
pub struct OperationView { pub struct OperationView {