Efficient maths algorithm to calculate intersections

后端 未结 9 772
既然无缘
既然无缘 2020-11-28 21:40

For a game I am developing I need an algorithm that can calculate intersections. I have solved the problem, but the way I have done it is really nasty and I am hoping someon

9条回答
  •  隐瞒了意图╮
    2020-11-28 22:42

    A simple optimization that may save you alot of time is to check the axis-aligned bounding boxes of the lines prior to getting into the intersection calculation.
    If the bounding boxes are completely disjoint then you can be certain there is no intersection.
    Of course this is dependent of the data you have. if an intersection is very likely in every check you make then you might find yourself wasting time on a check that is always true.

提交回复
热议问题