System.util.RectangleJ.IntersectsLine C# (CSharp) Méthode

IntersectsLine() public méthode

public IntersectsLine ( double x1, double y1, double x2, double y2 ) : bool
x1 double
y1 double
x2 double
y2 double
Résultat bool
        public bool IntersectsLine(double x1, double y1, double x2, double y2) {
            int out1, out2;
            if ((out2 = Outcode(x2, y2)) == 0) {
                return true;
            }
            while ((out1 = Outcode(x1, y1)) != 0) {
                if ((out1 & out2) != 0) {
                    return false;
                }
                if ((out1 & (OUT_LEFT | OUT_RIGHT)) != 0) {
                    float x = X;
                    if ((out1 & OUT_RIGHT) != 0) {
                        x += Width;
                    }
                    y1 = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
                    x1 = x;
                }
                else {
                    float y = Y;
                    if ((out1 & OUT_BOTTOM) != 0) {
                        y += Height;
                    }
                    x1 = x1 + (y - y1) * (x2 - x1) / (y2 - y1);
                    y1 = y;
                }
            }
            return true;
        }