示例#1
0
        //------------------------------------------------------------------------------

        internal static bool SlopesEqual(ClipperTEdge e1, ClipperTEdge e2, bool UseFullRange)
        {
            if (UseFullRange)
            {
                return(ClipperInt128.Int128Mul(e1.Delta.Y, e2.Delta.X) ==
                       ClipperInt128.Int128Mul(e1.Delta.X, e2.Delta.Y));
            }
            else
            {
                return((long)(e1.Delta.Y) * (e2.Delta.X) ==
                       (long)(e1.Delta.X) * (e2.Delta.Y));
            }
        }
示例#2
0
        //------------------------------------------------------------------------------

        internal static bool SlopesEqual(ClipperIntPoint pt1, ClipperIntPoint pt2,
                                         ClipperIntPoint pt3, ClipperIntPoint pt4, bool UseFullRange)
        {
            if (UseFullRange)
            {
                return(ClipperInt128.Int128Mul(pt1.Y - pt2.Y, pt3.X - pt4.X) ==
                       ClipperInt128.Int128Mul(pt1.X - pt2.X, pt3.Y - pt4.Y));
            }
            else
            {
                return
                    ((pt1.Y - pt2.Y) * (pt3.X - pt4.X) - (pt1.X - pt2.X) * (pt3.Y - pt4.Y) == 0);
            }
        }
示例#3
0
        //------------------------------------------------------------------------------

        internal bool PointOnLineSegment(ClipperIntPoint pt,
                                         ClipperIntPoint linePt1, ClipperIntPoint linePt2, bool UseFullRange)
        {
            if (UseFullRange)
            {
                return(((pt.X == linePt1.X) && (pt.Y == linePt1.Y)) ||
                       ((pt.X == linePt2.X) && (pt.Y == linePt2.Y)) ||
                       (((pt.X > linePt1.X) == (pt.X < linePt2.X)) &&
                        ((pt.Y > linePt1.Y) == (pt.Y < linePt2.Y)) &&
                        ((ClipperInt128.Int128Mul((pt.X - linePt1.X), (linePt2.Y - linePt1.Y)) ==
                          ClipperInt128.Int128Mul((linePt2.X - linePt1.X), (pt.Y - linePt1.Y))))));
            }
            else
            {
                return(((pt.X == linePt1.X) && (pt.Y == linePt1.Y)) ||
                       ((pt.X == linePt2.X) && (pt.Y == linePt2.Y)) ||
                       (((pt.X > linePt1.X) == (pt.X < linePt2.X)) &&
                        ((pt.Y > linePt1.Y) == (pt.Y < linePt2.Y)) &&
                        ((pt.X - linePt1.X) * (linePt2.Y - linePt1.Y) ==
                         (linePt2.X - linePt1.X) * (pt.Y - linePt1.Y))));
            }
        }