線分と四角形が交差しているか判定、交点座標を計算できます 線分同士の交点を4つの辺で求めてます
wikipedia https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_line_equations #lineclipper