fix polygon closure
authoralfadur
Wed, 14 Nov 2018 02:54:08 +0300
changeset 14208 87f1054c2333
parent 14207 bb2f301d4fe0
child 14209 ab1ef7074e07
fix polygon closure
rust/integral-geometry/src/lib.rs
--- a/rust/integral-geometry/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
+++ b/rust/integral-geometry/src/lib.rs	Wed Nov 14 02:54:08 2018 +0300
@@ -519,7 +519,8 @@
 
     fn force_close(&mut self) {
         if !self.vertices.is_empty() {
-            self.vertices[0] = self.vertices[self.vertices.len() - 1];
+            let edges_count = self.edges_count();
+            self.vertices[edges_count] = self.vertices[0];
         }
     }