ladybug-tools / ladybug-geometry

🐞 📦 A library with geometry objects used throughout the Ladybug Tools core libraries
https://www.ladybug.tools/ladybug-geometry/docs/
GNU Affero General Public License v3.0
25 stars 23 forks source link

remove_colinear_vertices() in Polygon2D remove all duplicated vertices #335

Closed eapuertoc closed 2 years ago

eapuertoc commented 2 years ago

Hi, if I have a polygon with duplicated vertices, the function remove both of them. I think is not the objective of this function, I had a rectangle with a vertice repeated and when I use this function convert the rectangle in triangle. I suggest add a function to remove duplicated vertices and before beginning the evaluation of vertices, use this function to avoid this behavior. Sometimes you just need to remove the duplicated vertices without remove the colinear vertices. In my case, for example, I'm trying to split lines in my polygon that match with vertices of other polygons in order to create the adjacency of the walls.

chriswmackey commented 2 years ago

Thank you for catching this, @eapuertoc , and sorry for the late response. I think I fixed this issue in the Face3D class but I maybe I forgot to fix it on the Polygon2D class. I will try to get to this soon.

Just to confirm, are you using the latest version of ladybug-geometry?

eapuertoc commented 2 years ago

Hi Chris, I can't find the version, I clone your repository on July 21 of 2021, but when I found the inconvenient, I corroborate with your last version and the function remains equal. I suggest that add a function just to remove the duplicated points, as I mentioned, I'm working in ellaborate models from CAD files and my intention is to create the match walls since the 2D sketch, so if the function eliminates all the collinear nodes, it will eliminate the nodes of intersections with other rooms.

chriswmackey commented 2 years ago

Thanks, @eapuertoc . It's all good. I verified that it's definitely a bug and I am pushing a fix now.