Skip to content

Commit

Permalink
Merge pull request hannobraun#2289 from hannobraun/topology
Browse files Browse the repository at this point in the history
Reframe "objects" as "topology"
  • Loading branch information
hannobraun authored Mar 23, 2024
2 parents 5d3bab7 + 155a8df commit b44e5bd
Show file tree
Hide file tree
Showing 117 changed files with 179 additions and 180 deletions.
4 changes: 2 additions & 2 deletions crates/fj-core/src/algorithms/approx/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::{
CurveBoundary, GlobalPath, HalfEdgeGeometry, SurfaceGeometry,
SurfacePath,
},
objects::Curve,
storage::Handle,
topology::Curve,
Core,
};

Expand Down Expand Up @@ -187,8 +187,8 @@ mod tests {
CurveBoundary, GlobalPath, HalfEdgeGeometry, SurfaceGeometry,
SurfacePath,
},
objects::Curve,
operations::insert::Insert,
topology::Curve,
Core,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use fj_math::Segment;

use crate::{geometry::SurfaceGeometry, objects::Cycle, Core};
use crate::{geometry::SurfaceGeometry, topology::Cycle, Core};

use super::{
edge::{HalfEdgeApprox, HalfEdgeApproxCache},
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! the caller doesn't have to deal with duplicate vertices.
use crate::{
geometry::SurfaceGeometry, objects::HalfEdge, storage::Handle, Core,
geometry::SurfaceGeometry, storage::Handle, topology::HalfEdge, Core,
};

use super::{
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::{collections::BTreeSet, ops::Deref};
use fj_interop::Color;

use crate::{
objects::{Face, Handedness, ObjectSet},
operations::presentation::GetColor,
topology::{Face, Handedness, ObjectSet},
validation::ValidationConfig,
Core,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::collections::BTreeSet;

use crate::{objects::Shell, Core};
use crate::{topology::Shell, Core};

use super::{edge::HalfEdgeApproxCache, face::FaceApprox, Approx, Tolerance};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::collections::BTreeSet;

use crate::{objects::Sketch, Core};
use crate::{topology::Sketch, Core};

use super::{edge::HalfEdgeApproxCache, face::FaceApprox, Approx, Tolerance};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::collections::BTreeSet;

use crate::{objects::Solid, Core};
use crate::{topology::Solid, Core};

use super::{edge::HalfEdgeApproxCache, face::FaceApprox, Approx, Tolerance};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/approx/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::BTreeMap;

use fj_math::Point;

use crate::{objects::Vertex, storage::Handle};
use crate::{storage::Handle, topology::Vertex};

/// Cache for vertex approximations
#[derive(Default)]
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/bounding_volume/cycle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use fj_math::Aabb;

use crate::{geometry::Geometry, objects::Cycle};
use crate::{geometry::Geometry, topology::Cycle};

impl super::BoundingVolume<2> for Cycle {
fn aabb(&self, geometry: &Geometry) -> Option<Aabb<2>> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/bounding_volume/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use fj_math::{Aabb, Vector};

use crate::{
geometry::{Geometry, SurfacePath},
objects::HalfEdge,
storage::Handle,
topology::HalfEdge,
};

impl super::BoundingVolume<2> for Handle<HalfEdge> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/bounding_volume/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use fj_math::Aabb;

use crate::{
geometry::{Geometry, GlobalPath},
objects::Face,
topology::Face,
};

impl super::BoundingVolume<3> for Face {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/bounding_volume/shell.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use fj_math::Aabb;

use crate::{geometry::Geometry, objects::Shell};
use crate::{geometry::Geometry, topology::Shell};

impl super::BoundingVolume<3> for Shell {
fn aabb(&self, geometry: &Geometry) -> Option<Aabb<3>> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/bounding_volume/solid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use fj_math::Aabb;

use crate::{geometry::Geometry, objects::Solid};
use crate::{geometry::Geometry, topology::Solid};

impl super::BoundingVolume<3> for Solid {
fn aabb(&self, geometry: &Geometry) -> Option<Aabb<3>> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/algorithms/triangulate/delaunay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use fj_math::{Point, Scalar, Triangle, Winding};
use spade::HasPosition;

use crate::{algorithms::approx::cycle::CycleApprox, objects::Handedness};
use crate::{algorithms::approx::cycle::CycleApprox, topology::Handedness};

/// Create a Delaunay triangulation of all points
pub fn triangulate(
Expand Down
8 changes: 4 additions & 4 deletions crates/fj-core/src/algorithms/triangulate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ mod tests {

use crate::{
algorithms::approx::{Approx, Tolerance},
objects::{Cycle, Face},
operations::{
build::{BuildCycle, BuildFace},
update::{UpdateFace, UpdateRegion},
},
topology::{Cycle, Face},
Core,
};

Expand All @@ -105,7 +105,7 @@ mod tests {
let d = [0., 1.];

let face =
Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core)
Face::unbound(core.layers.topology.surfaces.xy_plane(), &mut core)
.update_region(
|region, core| {
region.update_exterior(
Expand Down Expand Up @@ -145,7 +145,7 @@ mod tests {
let g = [3., 3.];
let h = [3., 1.];

let surface = core.layers.objects.surfaces.xy_plane();
let surface = core.layers.topology.surfaces.xy_plane();

let face = Face::unbound(surface.clone(), &mut core).update_region(
|region, core| {
Expand Down Expand Up @@ -234,7 +234,7 @@ mod tests {
let d = [1., 1.];
let e = [0., 9.];

let surface = core.layers.objects.surfaces.xy_plane();
let surface = core.layers.topology.surfaces.xy_plane();

let face = Face::unbound(surface.clone(), &mut core).update_region(
|region, core| {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/geometry/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use fj_math::Point;

use crate::{objects::Vertex, storage::Handle};
use crate::{storage::Handle, topology::Vertex};

/// A boundary on a curve
///
Expand Down
10 changes: 5 additions & 5 deletions crates/fj-core/src/geometry/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::collections::BTreeMap;
use fj_math::Vector;

use crate::{
objects::{HalfEdge, Objects, Surface},
storage::Handle,
topology::{HalfEdge, Surface, Topology},
};

use super::{GlobalPath, HalfEdgeGeometry, SurfaceGeometry};
Expand All @@ -21,14 +21,14 @@ pub struct Geometry {

impl Geometry {
/// Create a new instance of `Geometry`
pub fn new(objects: &Objects) -> Self {
pub fn new(topology: &Topology) -> Self {
let mut self_ = Self {
half_edge: BTreeMap::new(),
surface: BTreeMap::new(),

xy_plane: objects.surfaces.xy_plane(),
xz_plane: objects.surfaces.xz_plane(),
yz_plane: objects.surfaces.yz_plane(),
xy_plane: topology.surfaces.xy_plane(),
xz_plane: topology.surfaces.xz_plane(),
yz_plane: topology.surfaces.yz_plane(),
};

self_.define_surface_inner(
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/layers/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use crate::{
geometry::{Geometry, HalfEdgeGeometry, SurfaceGeometry},
objects::{HalfEdge, Surface},
storage::Handle,
topology::{HalfEdge, Surface},
};

use super::{Command, Event, Layer};
Expand Down
15 changes: 7 additions & 8 deletions crates/fj-core/src/layers/layers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
geometry::Geometry,
objects::Objects,
presentation::Presentation,
topology::Topology,
validation::{Validation, ValidationConfig},
};

Expand All @@ -22,11 +22,10 @@ use super::Layer;
/// For now, there is no need for this, and all layers are just hardcoded here.
/// That can be changed, once necessary.
pub struct Layers {
/// The objects layer
/// The topology layer
///
/// Manages the stores of topological and geometric objects that make up
/// shapes.
pub objects: Layer<Objects>,
/// Manages the stores of topological objects.
pub topology: Layer<Topology>,

/// The geometry layer
///
Expand All @@ -47,11 +46,11 @@ pub struct Layers {
impl Layers {
/// Construct an instance of `Layers`
pub fn new() -> Self {
let objects = Objects::new();
let geometry = Geometry::new(&objects);
let topology = Topology::new();
let geometry = Geometry::new(&topology);

Self {
objects: Layer::new(objects),
topology: Layer::new(topology),
geometry: Layer::new(geometry),
validation: Layer::default(),
presentation: Layer::default(),
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/layers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! See [`Layers`].
pub mod geometry;
pub mod objects;
pub mod presentation;
pub mod topology;
pub mod validation;

mod layer;
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/layers/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use fj_interop::Color;

use crate::{
objects::{AnyObject, Region, Stored},
presentation::Presentation,
storage::Handle,
topology::{AnyObject, Region, Stored},
};

use super::{Command, Event, Layer};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Layer infrastructure for [`Objects`]
//! Layer infrastructure for [`Topology`]
use crate::{
geometry::Geometry,
objects::{AboutToBeStored, AnyObject, Objects},
topology::{AboutToBeStored, AnyObject, Topology},
validation::Validation,
};

use super::{validation::ValidateObject, Command, Event, Layer};

impl Layer<Objects> {
impl Layer<Topology> {
/// Insert an object into the stores
///
/// Passes any events produced to the validation layer.
Expand Down Expand Up @@ -38,17 +38,17 @@ pub struct InsertObject {
pub object: AnyObject<AboutToBeStored>,
}

impl Command<Objects> for InsertObject {
impl Command<Topology> for InsertObject {
type Result = ();
type Event = InsertObject;

fn decide(self, _: &Objects, events: &mut Vec<Self::Event>) {
fn decide(self, _: &Topology, events: &mut Vec<Self::Event>) {
events.push(self);
}
}

impl Event<Objects> for InsertObject {
fn evolve(&self, state: &mut Objects) {
impl Event<Topology> for InsertObject {
fn evolve(&self, state: &mut Topology) {
self.object.clone().insert(state);
}
}
2 changes: 1 addition & 1 deletion crates/fj-core/src/layers/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::{
geometry::Geometry,
objects::{AnyObject, Stored},
topology::{AnyObject, Stored},
validation::{Validation, ValidationError, ValidationErrors},
};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@
pub mod algorithms;
pub mod geometry;
pub mod layers;
pub mod objects;
pub mod operations;
pub mod presentation;
pub mod queries;
pub mod storage;
pub mod topology;
pub mod validate;
pub mod validation;

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/operations/build/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use fj_math::{Point, Scalar};
use itertools::Itertools;

use crate::{
objects::{Cycle, HalfEdge},
operations::{build::BuildHalfEdge, update::UpdateCycle},
topology::{Cycle, HalfEdge},
Core,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/operations/build/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use fj_interop::ext::ArrayExt;
use fj_math::{Point, Scalar};

use crate::{
objects::{Cycle, Face, HalfEdge, Region, Surface, Vertex},
operations::{
build::{BuildCycle, BuildRegion, BuildSurface},
insert::{Insert, IsInserted, IsInsertedNo},
},
storage::Handle,
topology::{Cycle, Face, HalfEdge, Region, Surface, Vertex},
Core,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/operations/build/half_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use fj_math::{Arc, Point, Scalar};

use crate::{
geometry::{HalfEdgeGeometry, SurfacePath},
objects::{Curve, HalfEdge, Vertex},
operations::{geometry::UpdateHalfEdgeGeometry, insert::Insert},
storage::Handle,
topology::{Curve, HalfEdge, Vertex},
Core,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-core/src/operations/build/region.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use fj_math::{Point, Scalar};

use crate::{
objects::{Cycle, Region},
operations::{build::BuildCycle, insert::Insert},
topology::{Cycle, Region},
Core,
};

Expand Down
Loading

0 comments on commit b44e5bd

Please sign in to comment.