BHoM / BHoM_Engine

Internal manipulation of the BHoM
GNU Lesser General Public License v3.0
26 stars 13 forks source link

Geometry_Engine: Collinearity check is not precise enough #3285

Closed pawelbaran closed 6 months ago

pawelbaran commented 6 months ago

Description:

Query.IsCollinear(List<Point>, double) is currently a numerical check rather than geometrical - we create a matrix based on point coordinates and check whether it has enough zero rows. Transformation of geometrical tolerance to numerical is virtually impossible, therefore in edge cases points that should be considered collinear within tolerance, are returned as not, which starts becoming an issue in more complex workflows using this method.

This could be fixed by fitting an infinite line between points and then checking if they lie within tolerance from it.

Test file(s):

pawelbaran commented 6 months ago

After more experimentation I realised the changes to this particular method are not as easy to implement, plus the issues I experienced originated from other areas in the code. Therefore I will close this issue and reopen only if that becomes problematic.

pawelbaran commented 6 months ago

Reopening as issues related to the tolerance of collinearity check kept on haunting me while working on https://github.com/BHoM/BHoM_Engine/pull/3283