/// <summary> /// /// </summary> /// <param name="p0"></param> /// <param name="p1"></param> protected void Init(ICoordinate p0, ICoordinate p1) { this.p0 = p0; this.p1 = p1; dx = p1.X - p0.X; dy = p1.Y - p0.Y; quadrant = QuadrantOp.Quadrant(dx, dy); Assert.IsTrue(!(dx == 0 && dy == 0), "EdgeEnd with identical endpoints found"); }
/// <summary> /// The coordinate pairs match if they define line segments lying in the same direction. /// E.g. the segments are parallel and in the same quadrant /// (as opposed to parallel and opposite!). /// </summary> /// <param name="p0"></param> /// <param name="p1"></param> /// <param name="ep0"></param> /// <param name="ep1"></param> private bool MatchInSameDirection(ICoordinate p0, ICoordinate p1, ICoordinate ep0, ICoordinate ep1) { if (!p0.Equals(ep0)) { return(false); } if (CGAlgorithms.ComputeOrientation(p0, p1, ep1) == CGAlgorithms.Collinear && QuadrantOp.Quadrant(p0, p1) == QuadrantOp.Quadrant(ep0, ep1)) { return(true); } return(false); }