Transformation to get rid of collinear points

前端 未结 2 931
眼角桃花
眼角桃花 2021-01-22 01:15

I\'m writing a program to solve a geometry problem.

My algorithm doesn\'t treat collinear point very well.

Is there any transformation I can apply to the points

2条回答
  •  天涯浪人
    2021-01-22 01:53

    If you are working with a lot of point sets, adding noise to every set may solve the problem in one set, but create it in another.

    If that is the case, you can test the colinearity before applying the noise.

    The colinearity condition is:

           x1  y1  1
      det  x2  y2  1  = 0
           x3  y3  1
    

提交回复
热议问题