Example #1
0
    public bool Intersects(Seg2d s, double t0)
    {
        Vector2d aa = s.a - a;
        double det = Vector2d.Cross(ab, s.ab);
        t0 = Vector2d.Cross(aa, s.ab) / det;

        if (t0 > 0 && t0 < 1) {
            double t1 = Vector2d.Cross(aa, ab) / det;
            return t1 > 0 && t1 < 1;
        }

        return false;
    }
Example #2
0
    /*
     * Returns true if this segment intersects the given segment.
     *
     * @param s a segment.
     */
    public bool Intersects(Seg2d s)
    {
        Vector2d aa  = s.a - a;
        double   det = Vector2d.Cross(ab, s.ab);
        double   t0  = Vector2d.Cross(aa, s.ab) / det;

        if (t0 > 0 && t0 < 1)
        {
            double t1 = Vector2d.Cross(aa, ab) / det;
            return(t1 > 0 && t1 < 1);
        }

        return(false);
    }
Example #3
0
        /*
         * Returns true if this segment intersects the given segment.
         *
         * @param s a segment.
         */

        public bool Intersects(Seg2d s)
        {
            var aa  = s.a - a;
            var det = Vector2d.Cross(ab, s.ab);
            var t0  = Vector2d.Cross(aa, s.ab) / det;

            if (t0 > 0 && t0 < 1)
            {
                var t1 = Vector2d.Cross(aa, ab) / det;
                return(t1 > 0 && t1 < 1);
            }

            return(false);
        }