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 GlobalVertex::from_position to new #1410

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions crates/fj-kernel/src/algorithms/sweep/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ impl Sweep for Handle<GlobalVertex> {
.global_vertex
.entry(self.id())
.or_insert_with(|| {
GlobalVertex::from_position(self.position() + path.into())
.insert(objects)
GlobalVertex::new(self.position() + path.into()).insert(objects)
})
.clone();

Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/transform/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ impl TransformObject for GlobalVertex {
_: &mut TransformCache,
) -> Self {
let position = transform.transform_point(&self.position());
Self::from_position(position)
Self::new(position)
}
}
8 changes: 4 additions & 4 deletions crates/fj-kernel/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ mod tests {
fn global_vertex() {
let mut services = Services::new();

let object = GlobalVertex::from_position([0., 0., 0.])
.insert(&mut services.objects);
let object =
GlobalVertex::new([0., 0., 0.]).insert(&mut services.objects);

assert_eq!(0, object.curve_iter().count());
assert_eq!(0, object.cycle_iter().count());
Expand Down Expand Up @@ -619,8 +619,8 @@ mod tests {
let curve = curve
.build(&mut services.objects)
.insert(&mut services.objects);
let global_vertex = GlobalVertex::from_position([0., 0., 0.])
.insert(&mut services.objects);
let global_vertex =
GlobalVertex::new([0., 0., 0.]).insert(&mut services.objects);
let surface_vertex =
SurfaceVertex::new([0., 0.], surface, global_vertex)
.insert(&mut services.objects);
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/objects/full/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub struct GlobalVertex {

impl GlobalVertex {
/// Construct a `GlobalVertex` from a position
pub fn from_position(position: impl Into<Point<3>>) -> Self {
pub fn new(position: impl Into<Point<3>>) -> Self {
let position = position.into();
Self { position }
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/partial/objects/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl PartialGlobalVertex {
.position
.expect("Can't build a `GlobalVertex` without a position");

GlobalVertex::from_position(position)
GlobalVertex::new(position)
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/fj-kernel/src/validate/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ mod tests {
let invalid = SurfaceVertex::new(
valid.position(),
valid.surface().clone(),
GlobalVertex::from_position([1., 0., 0.])
.insert(&mut services.objects),
GlobalVertex::new([1., 0., 0.]).insert(&mut services.objects),
);

assert!(valid.validate().is_ok());
Expand Down