mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-26 01:38:06 +00:00
Implement TranslateExt for Vertex
This commit is contained in:
parent
dd0074abdd
commit
3754d9e9b2
@ -1,4 +1,8 @@
|
||||
use crate::{math::Vector, object::Handle, topology::face::Face};
|
||||
use crate::{
|
||||
math::Vector,
|
||||
object::Handle,
|
||||
topology::{face::Face, vertex::Vertex},
|
||||
};
|
||||
|
||||
pub trait TranslateExt {
|
||||
fn translate(self, offset: impl Into<Vector<3>>) -> Self;
|
||||
@ -16,3 +20,10 @@ impl TranslateExt for Face {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl TranslateExt for Vertex {
|
||||
fn translate(self, offset: impl Into<Vector<3>>) -> Self {
|
||||
let offset = offset.into();
|
||||
Vertex::new(self.point + offset)
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ use std::fmt;
|
||||
|
||||
use crate::{
|
||||
geometry::TriMesh,
|
||||
math::{Point, Vector},
|
||||
math::Point,
|
||||
object::{HandleAny, Object},
|
||||
};
|
||||
|
||||
@ -16,12 +16,6 @@ impl Vertex {
|
||||
let point = point.into();
|
||||
Self { point }
|
||||
}
|
||||
|
||||
pub fn translate(self, offset: impl Into<Vector<3>>) -> Self {
|
||||
Self {
|
||||
point: self.point + offset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Object for Vertex {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user