public static bool Circle2dWithOrientedRectangle2d(Circle2d circle, OrientedRectangle2d rectangle)
    {
        Vector3L        forward  = RotateHelper.GetForward(rectangle.m_rotation);
        Vector3L        right    = Vector3L.Cross(Vector3L.up, forward);
        Vector3L        pos      = new Vector3L(rectangle.m_pos.x, 0, rectangle.m_pos.y);
        Vector3L        a        = pos + forward * rectangle.m_length * 0.5f + -right * rectangle.m_width * 0.5f;
        Vector3L        b        = pos + forward * rectangle.m_length * 0.5f + right * rectangle.m_width * 0.5f;
        Vector3L        c        = pos + -forward * rectangle.m_length * 0.5f + right * rectangle.m_width * 0.5f;
        Vector3L        d        = pos + -forward * rectangle.m_length * 0.5f + -right * rectangle.m_width * 0.5f;
        List <Vector2L> lineList = new List <Vector2L>();

        lineList.Add(new Vector2L(a.x, a.z));
        lineList.Add(new Vector2L(b.x, b.z));
        lineList.Add(new Vector2L(c.x, c.z));
        lineList.Add(new Vector2L(d.x, d.z));
        for (int i = 0; i < lineList.Count; ++i)
        {
            Segment2d segment = new Segment2d();
            segment.m_point1 = lineList[i];
            segment.m_point2 = lineList[(i + 1) % lineList.Count];
            if (Segment2dWithCircle2d(segment, circle))
            {
                return(true);
            }
        }
        return(false);
    }
    public static bool Line2dWithOrientedRectangle2d(Line2d line, OrientedRectangle2d rectangle2d)
    {
        Vector3L        forward  = RotateHelper.GetForward(rectangle2d.m_rotation);
        Vector3L        right    = Vector3L.Cross(Vector3L.up, forward);
        Vector3L        pos      = new Vector3L(rectangle2d.m_pos.x, 0, rectangle2d.m_pos.y);
        Vector3L        a        = pos + forward * rectangle2d.m_length * 0.5f + -right * rectangle2d.m_width * 0.5f;
        Vector3L        b        = pos + forward * rectangle2d.m_length * 0.5f + right * rectangle2d.m_width * 0.5f;
        Vector3L        c        = pos + -forward * rectangle2d.m_length * 0.5f + right * rectangle2d.m_width * 0.5f;
        Vector3L        d        = pos + -forward * rectangle2d.m_length * 0.5f + -right * rectangle2d.m_width * 0.5f;
        List <Vector2L> lineList = new List <Vector2L>();

        lineList.Add(new Vector2L(a.x, a.z));
        lineList.Add(new Vector2L(b.x, b.z));
        lineList.Add(new Vector2L(c.x, c.z));
        lineList.Add(new Vector2L(d.x, d.z));
        for (int i = 0; i < lineList.Count; ++i)
        {
            if (IsTwoSegmentIntersection(lineList[i], lineList[(i + 1) % lineList.Count], line.m_point1, line.m_point2))
            {
                return(true);
            }
        }

        return(false);
    }
    public static bool Point2dWithRectangle2d(Vector2L point2d, OrientedRectangle2d rectangle2d)
    {
        Vector3L forward = RotateHelper.GetForward(rectangle2d.m_rotation);
        Vector3L right   = Vector3L.Cross(Vector3L.up, forward);
        Vector3L pos     = new Vector3L(rectangle2d.m_pos.x, 0, rectangle2d.m_pos.y);
        Vector3L a       = pos + forward * rectangle2d.m_length * 0.5f + -right * rectangle2d.m_width * 0.5f;
        Vector3L b       = pos + forward * rectangle2d.m_length * 0.5f + right * rectangle2d.m_width * 0.5f;
        Vector3L c       = pos + -forward * rectangle2d.m_length * 0.5f + right * rectangle2d.m_width * 0.5f;
        Vector3L d       = pos + -forward * rectangle2d.m_length * 0.5f + -right * rectangle2d.m_width * 0.5f;

        return(IsInRectangle2d(a, b, c, d, new Vector3L(point2d.x, 0, point2d.y)));
    }
    public static bool Point2dWithSector2d(Vector2L pos, Sector2d sector2d)
    {
        Vector2L distance = pos - sector2d.m_pos;

        if (distance.magnitude > sector2d.m_radius)
        {
            return(false);
        }

        Vector3L sectorForward = RotateHelper.GetForward(sector2d.m_rotation);
        FloatL   cosTarget     = Vector3L.Dot(sectorForward, distance) / sectorForward.magnitude / distance.magnitude;
        FloatL   cosHalfDegree = FixPointMath.Cos((FixPointMath.Deg2Rad * sector2d.m_theraDegree / 2));

        return(cosTarget > cosHalfDegree);
    }