mirror of
				https://github.com/hannobraun/Fornjot
				synced 2025-10-31 04:08:17 +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 { | pub trait TranslateExt { | ||||||
|     fn translate(self, offset: impl Into<Vector<3>>) -> Self; |     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::{ | use crate::{ | ||||||
|     geometry::TriMesh, |     geometry::TriMesh, | ||||||
|     math::{Point, Vector}, |     math::Point, | ||||||
|     object::{HandleAny, Object}, |     object::{HandleAny, Object}, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| @ -16,12 +16,6 @@ impl Vertex { | |||||||
|         let point = point.into(); |         let point = point.into(); | ||||||
|         Self { point } |         Self { point } | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     pub fn translate(self, offset: impl Into<Vector<3>>) -> Self { |  | ||||||
|         Self { |  | ||||||
|             point: self.point + offset, |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Object for Vertex { | impl Object for Vertex { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user