Java- Intersection point of a Polygon and Line

前端 未结 5 1289
轮回少年
轮回少年 2020-12-01 14:51

Is there any function that will give me the intersection point of a Polygon and Line2D ?

I have a Polygon and a line segment that I know

5条回答
  •  星月不相逢
    2020-12-01 15:22

    With great success, i used this approach:

    Area a = new Area(shape1);
    Area b = new Area(shape2);
    b.intersect(a);
    if (!b.isEmpty()) {
      //Shapes have non-empty intersection, so do you actions.
      //In case of need, actual intersection is in Area b. (its destructive operation)
    }
    

提交回复
热议问题