File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ use alloc::vec::Vec;
44use i_overlay:: i_float:: int:: point:: IntPoint ;
55
66impl IntDelaunay {
7+ /// Returns the vertex positions in the triangulation.
78 #[ inline]
89 pub fn points ( & self ) -> & Vec < IntPoint > {
910 & self . points
1011 }
1112
13+ /// Returns indices forming counter-clockwise triangles.
1214 #[ inline]
1315 pub fn triangle_indices < I : IndexType > ( & self ) -> Vec < I > {
1416 let mut result = Vec :: with_capacity ( 3 * self . triangles . len ( ) ) ;
@@ -23,6 +25,15 @@ impl IntDelaunay {
2325 result
2426 }
2527
28+ /// Returns the indices of each triangle's neighboring triangles.
29+ #[ inline]
30+ pub fn triangle_neighbors ( & self ) -> Vec < [ usize ; 3 ] > {
31+ self . triangles
32+ . iter ( )
33+ . map ( |triangle| triangle. neighbors )
34+ . collect ( )
35+ }
36+
2637 #[ inline]
2738 pub fn into_triangulation < I : IndexType > ( self ) -> IntTriangulation < I > {
2839 IntTriangulation {
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ impl<P: FloatPointCompatible> Delaunay<P> {
4545 self . delaunay . triangle_indices ( )
4646 }
4747
48+ /// Returns the indices of each triangle's neighboring triangles.
49+ #[ inline]
50+ pub fn triangle_neighbors ( & self ) -> Vec < [ usize ; 3 ] > {
51+ self . delaunay . triangle_neighbors ( )
52+ }
53+
4854 /// Converts this refined mesh into a flat float [`Triangulation`].
4955 #[ inline]
5056 pub fn to_triangulation < I : IndexType > ( & self ) -> Triangulation < P , I > {
Original file line number Diff line number Diff line change @@ -154,14 +154,22 @@ impl RawIntTriangulation {
154154 /// Returns a flat list of triangle vertex indices (ABC ordering).
155155 ///
156156 /// Each triangle contributes 3 indices into the `points` buffer.
157- ///
158157 #[ inline]
159158 pub fn triangle_indices < I : IndexType > ( & self ) -> Vec < I > {
160159 let mut indices = Vec :: new ( ) ;
161160 self . triangles . feed_indices ( self . points . len ( ) , & mut indices) ;
162161 indices
163162 }
164163
164+ /// Returns the indices of each triangle's neighboring triangles.
165+ #[ inline]
166+ pub fn triangle_neighbors ( & self ) -> Vec < [ usize ; 3 ] > {
167+ self . triangles
168+ . iter ( )
169+ . map ( |triangle| triangle. neighbors )
170+ . collect ( )
171+ }
172+
165173 /// Converts the int triangulation into a simpler index-based mesh.
166174 ///
167175 /// Returns a [`IntTriangulation`] with separate index buffer and point list.
You can’t perform that action at this time.
0 commit comments