File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
rust/sedona-geo-traits-ext/src Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 7474 #[ inline]
7575 fn rev_lines ( & ' _ self ) -> impl ExactSizeIterator < Item = Line < <Self as GeometryTrait >:: T > > + ' _ {
7676 let num_coords = self . num_coords ( ) ;
77- ( num_coords - 1 ..0 ) . map ( |i| unsafe {
77+ ( 1 ..num_coords ) . rev ( ) . map ( |i| unsafe {
7878 let coord1 = self . coord_unchecked_ext ( i) ;
7979 let coord2 = self . coord_unchecked_ext ( i - 1 ) ;
8080 Line :: new ( coord2. geo_coord ( ) , coord1. geo_coord ( ) )
@@ -104,10 +104,17 @@ where
104104 #[ inline]
105105 /// Returns true when the line string is closed (its first and last coordinates are equal).
106106 fn is_closed ( & self ) -> bool {
107- match ( self . coords_ext ( ) . next ( ) , self . coords_ext ( ) . last ( ) ) {
108- ( Some ( first) , Some ( last) ) => first. geo_coord ( ) == last. geo_coord ( ) ,
109- ( None , None ) => true ,
110- _ => false ,
107+ let num_coords = self . num_coords ( ) ;
108+ if num_coords <= 1 {
109+ true
110+ } else {
111+ let ( first, last) = unsafe {
112+ (
113+ self . geo_coord_unchecked ( 0 ) ,
114+ self . geo_coord_unchecked ( num_coords - 1 ) ,
115+ )
116+ } ;
117+ first == last
111118 }
112119 }
113120}
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ where
113113 Line :: new (
114114 coord ! {
115115 x: max_coord. x,
116- y: min_coord . y,
116+ y: max_coord . y,
117117 } ,
118118 coord ! {
119119 x: min_coord. x,
You can’t perform that action at this time.
0 commit comments