Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Stores to Objects, move it to objects #1198

Merged
merged 57 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3eee6a2
Move `Stores` to `objects`
hannobraun Oct 10, 2022
5e8773c
Rename `stores` to `storage`
hannobraun Oct 10, 2022
71157ad
Rename `Stores` to `Objects`
hannobraun Oct 10, 2022
279128f
Rename variables
hannobraun Oct 10, 2022
48e1d89
Rename variables
hannobraun Oct 10, 2022
e8062c1
Rename variable
hannobraun Oct 10, 2022
17ca861
Rename argument
hannobraun Oct 10, 2022
123bfe7
Rename variables
hannobraun Oct 10, 2022
9fe75e2
Rename variables
hannobraun Oct 10, 2022
b1fabb7
Rename variables
hannobraun Oct 10, 2022
46dbd27
Rename argument
hannobraun Oct 10, 2022
2bf54b1
Rename variable
hannobraun Oct 10, 2022
93a02cb
Rename argument
hannobraun Oct 10, 2022
a4b59c0
Rename argument
hannobraun Oct 10, 2022
7fa522d
Rename variable
hannobraun Oct 10, 2022
f23cd7b
Rename argument
hannobraun Oct 10, 2022
a0ac529
Rename variables
hannobraun Oct 10, 2022
264595d
Rename argument
hannobraun Oct 10, 2022
fcc930a
Rename argument
hannobraun Oct 10, 2022
ae73ce9
Rename arguments
hannobraun Oct 10, 2022
452ec90
Rename variable
hannobraun Oct 10, 2022
604be50
Rename arguments
hannobraun Oct 10, 2022
fbc193c
Rename argument
hannobraun Oct 10, 2022
50db73e
Rename arguments
hannobraun Oct 10, 2022
aecf689
Rename arguments
hannobraun Oct 10, 2022
2b865ed
Rename arguments
hannobraun Oct 10, 2022
af8de8f
Rename argument
hannobraun Oct 10, 2022
a123d6e
Rename argument
hannobraun Oct 10, 2022
09cdb22
Rename argument
hannobraun Oct 10, 2022
3430173
Rename argument
hannobraun Oct 10, 2022
45cf50e
Rename arguments
hannobraun Oct 10, 2022
9bbe09e
Rename variables
hannobraun Oct 10, 2022
02d71a0
Update variable names
hannobraun Oct 10, 2022
0d77bd6
Rename variables
hannobraun Oct 10, 2022
9bd970d
Rename struct field
hannobraun Oct 10, 2022
68835c1
Rename struct field
hannobraun Oct 10, 2022
ebea388
Rename struct field
hannobraun Oct 10, 2022
21cf520
Rename struct field
hannobraun Oct 10, 2022
315b7bf
Rename variables
hannobraun Oct 10, 2022
2268b4a
Rename arguments
hannobraun Oct 10, 2022
fabb6ae
Rename variable
hannobraun Oct 10, 2022
1d7c100
Rename argument
hannobraun Oct 10, 2022
a7207d9
Rename argument
hannobraun Oct 10, 2022
fa899fc
Rename argument
hannobraun Oct 10, 2022
e43dcac
Rename argument
hannobraun Oct 10, 2022
f54bfe9
Rename argument
hannobraun Oct 10, 2022
d5abf06
Rename argument
hannobraun Oct 10, 2022
fa90e7f
Rename arguments
hannobraun Oct 10, 2022
61e9510
Rename argument
hannobraun Oct 10, 2022
da5cf26
Rename argument
hannobraun Oct 10, 2022
c1364d2
Rename argument
hannobraun Oct 10, 2022
bdbed13
Rename arguments
hannobraun Oct 10, 2022
dc9ce19
Rename argument
hannobraun Oct 10, 2022
89a8489
Rename variable
hannobraun Oct 10, 2022
72f0298
Rename argument
hannobraun Oct 10, 2022
3332b62
Rename argument
hannobraun Oct 10, 2022
10839ba
Rename argument
hannobraun Oct 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions crates/fj-kernel/src/algorithms/approx/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::collections::BTreeMap;
use crate::{
objects::{Curve, GlobalCurve},
path::{GlobalPath, SurfacePath},
stores::{Handle, ObjectId},
storage::{Handle, ObjectId},
};

use super::{path::RangeOnPath, Approx, ApproxPoint, Tolerance};
Expand Down Expand Up @@ -197,25 +197,25 @@ mod tests {

use crate::{
algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint},
objects::{Curve, Surface},
objects::{Curve, Objects, Surface},
partial::HasPartial,
path::GlobalPath,
stores::{Handle, Stores},
storage::Handle,
};

use super::CurveApprox;

#[test]
fn approx_line_on_flat_surface() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores
let surface = objects
.surfaces
.insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.]));
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface))
.as_line_from_points([[1., 1.], [2., 1.]])
.build(&stores);
.build(&objects);
let range = RangeOnPath::from([[0.], [1.]]);

let approx = (&curve, range).approx(1.);
Expand All @@ -225,16 +225,16 @@ mod tests {

#[test]
fn approx_line_on_curved_surface_but_not_along_curve() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::new(
let surface = objects.surfaces.insert(Surface::new(
GlobalPath::circle_from_radius(1.),
[0., 0., 1.],
));
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface))
.as_line_from_points([[1., 1.], [1., 2.]])
.build(&stores);
.build(&objects);
let range = RangeOnPath::from([[0.], [1.]]);

let approx = (&curve, range).approx(1.);
Expand All @@ -244,14 +244,14 @@ mod tests {

#[test]
fn approx_line_on_curved_surface_along_curve() {
let stores = Stores::new();
let objects = Objects::new();

let path = GlobalPath::circle_from_radius(1.);
let surface = stores.surfaces.insert(Surface::new(path, [0., 0., 1.]));
let surface = objects.surfaces.insert(Surface::new(path, [0., 0., 1.]));
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_line_from_points([[0., 1.], [1., 1.]])
.build(&stores);
.build(&objects);

let range = RangeOnPath::from([[0.], [TAU]]);
let tolerance = 1.;
Expand All @@ -274,15 +274,15 @@ mod tests {

#[test]
fn approx_circle_on_flat_surface() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores
let surface = objects
.surfaces
.insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.]));
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface))
.as_circle_from_radius(1.)
.build(&stores);
.build(&objects);

let range = RangeOnPath::from([[0.], [TAU]]);
let tolerance = 1.;
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/approx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{

use fj_math::Point;

use crate::{objects::Curve, stores::Handle};
use crate::{objects::Curve, storage::Handle};

pub use self::tolerance::{InvalidTolerance, Tolerance};

Expand Down
36 changes: 18 additions & 18 deletions crates/fj-kernel/src/algorithms/intersect/curve_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,26 @@ mod tests {
use fj_math::Point;

use crate::{
objects::{Curve, HalfEdge, Surface},
objects::{Curve, HalfEdge, Objects, Surface},
partial::HasPartial,
stores::{Handle, Stores},
storage::Handle,
};

use super::CurveEdgeIntersection;

#[test]
fn compute_edge_in_front_of_curve_origin() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::xy_plane());
let surface = objects.surfaces.insert(Surface::xy_plane());
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_u_axis()
.build(&stores);
.build(&objects);
let half_edge = HalfEdge::partial()
.with_surface(Some(surface))
.as_line_segment_from_points([[1., -1.], [1., 1.]])
.build(&stores);
.build(&objects);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -108,17 +108,17 @@ mod tests {

#[test]
fn compute_edge_behind_curve_origin() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::xy_plane());
let surface = objects.surfaces.insert(Surface::xy_plane());
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_u_axis()
.build(&stores);
.build(&objects);
let half_edge = HalfEdge::partial()
.with_surface(Some(surface))
.as_line_segment_from_points([[-1., -1.], [-1., 1.]])
.build(&stores);
.build(&objects);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -132,17 +132,17 @@ mod tests {

#[test]
fn compute_edge_parallel_to_curve() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::xy_plane());
let surface = objects.surfaces.insert(Surface::xy_plane());
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_u_axis()
.build(&stores);
.build(&objects);
let half_edge = HalfEdge::partial()
.with_surface(Some(surface))
.as_line_segment_from_points([[-1., -1.], [1., -1.]])
.build(&stores);
.build(&objects);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -151,17 +151,17 @@ mod tests {

#[test]
fn compute_edge_on_curve() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::xy_plane());
let surface = objects.surfaces.insert(Surface::xy_plane());
let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_u_axis()
.build(&stores);
.build(&objects);
let half_edge = HalfEdge::partial()
.with_surface(Some(surface))
.as_line_segment_from_points([[-1., 0.], [1., 0.]])
.build(&stores);
.build(&objects);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand Down
12 changes: 6 additions & 6 deletions crates/fj-kernel/src/algorithms/intersect/curve_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,23 @@ where
#[cfg(test)]
mod tests {
use crate::{
objects::{Curve, Face, Surface},
objects::{Curve, Face, Objects, Surface},
partial::HasPartial,
stores::{Handle, Stores},
storage::Handle,
};

use super::CurveFaceIntersection;

#[test]
fn compute() {
let stores = Stores::new();
let objects = Objects::new();

let surface = stores.surfaces.insert(Surface::xy_plane());
let surface = objects.surfaces.insert(Surface::xy_plane());

let curve = Handle::<Curve>::partial()
.with_surface(Some(surface.clone()))
.as_line_from_points([[-3., 0.], [-2., 0.]])
.build(&stores);
.build(&objects);

#[rustfmt::skip]
let exterior = [
Expand All @@ -189,7 +189,7 @@ mod tests {
[ 1., -1.],
];

let face = Face::builder(&stores, surface)
let face = Face::builder(&objects, surface)
.with_exterior_polygon_from_points(exterior)
.with_interior_polygon_from_points(interior)
.build();
Expand Down
30 changes: 15 additions & 15 deletions crates/fj-kernel/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
objects::{Curve, Face},
stores::{Handle, Stores},
objects::{Curve, Face, Objects},
storage::Handle,
};

use super::{CurveFaceIntersection, SurfaceSurfaceIntersection};
Expand All @@ -24,11 +24,11 @@ pub struct FaceFaceIntersection {

impl FaceFaceIntersection {
/// Compute the intersections between two faces
pub fn compute(faces: [&Face; 2], stores: &Stores) -> Option<Self> {
pub fn compute(faces: [&Face; 2], objects: &Objects) -> Option<Self> {
let surfaces = faces.map(|face| face.surface().clone());

let intersection_curves =
SurfaceSurfaceIntersection::compute(surfaces, stores)?
SurfaceSurfaceIntersection::compute(surfaces, objects)?
.intersection_curves;

// Can be cleaned up, once `zip` is stable:
Expand Down Expand Up @@ -64,16 +64,16 @@ mod tests {

use crate::{
algorithms::intersect::CurveFaceIntersection,
objects::{Curve, Face, Surface},
objects::{Curve, Face, Objects, Surface},
partial::HasPartial,
stores::{Handle, Stores},
storage::Handle,
};

use super::FaceFaceIntersection;

#[test]
fn compute_no_intersection() {
let stores = Stores::new();
let objects = Objects::new();

#[rustfmt::skip]
let points = [
Expand All @@ -84,20 +84,20 @@ mod tests {
];
let [a, b] =
[Surface::xy_plane(), Surface::xz_plane()].map(|surface| {
let surface = stores.surfaces.insert(surface);
Face::builder(&stores, surface)
let surface = objects.surfaces.insert(surface);
Face::builder(&objects, surface)
.with_exterior_polygon_from_points(points)
.build()
});

let intersection = FaceFaceIntersection::compute([&a, &b], &stores);
let intersection = FaceFaceIntersection::compute([&a, &b], &objects);

assert!(intersection.is_none());
}

#[test]
fn compute_one_intersection() {
let stores = Stores::new();
let objects = Objects::new();

#[rustfmt::skip]
let points = [
Expand All @@ -107,20 +107,20 @@ mod tests {
[-1., 1.],
];
let surfaces = [Surface::xy_plane(), Surface::xz_plane()]
.map(|surface| stores.surfaces.insert(surface));
.map(|surface| objects.surfaces.insert(surface));
let [a, b] = surfaces.clone().map(|surface| {
Face::builder(&stores, surface)
Face::builder(&objects, surface)
.with_exterior_polygon_from_points(points)
.build()
});

let intersection = FaceFaceIntersection::compute([&a, &b], &stores);
let intersection = FaceFaceIntersection::compute([&a, &b], &objects);

let expected_curves = surfaces.map(|surface| {
Handle::<Curve>::partial()
.with_surface(Some(surface))
.as_line_from_points([[0., 0.], [1., 0.]])
.build(&stores)
.build(&objects)
});
let expected_intervals =
CurveFaceIntersection::from_intervals([[[-1.], [1.]]]);
Expand Down
Loading