public RelativeEdgePosition Cross(EdgeInterface e, out double t) { double s = 0.0; RelativeEdgePosition crossType = e.Intersect(this, out s); if ((crossType == RelativeEdgePosition.COLLINEAR) || (crossType == RelativeEdgePosition.PARALLEL)) { t = 0.0; return(crossType); } if ((s < 0.0) || (s > 1.0)) { t = 0.0; return(RelativeEdgePosition.SKEW_NO_CROSS); } Intersect(e, out t); if ((0.0 <= t) && (t <= 1.0)) { return(RelativeEdgePosition.SKEW_CROSS); } else { return(RelativeEdgePosition.SKEW_NO_CROSS); } }
public override void Test() { this.scene = new List <ViewItemInterface>(); edge0 = new Edge(10, 10, 100, 50); edge1 = new Edge(100, 5, 5, 100); this.scene.Add(new EdgeView(edge0)); this.scene.Add(new EdgeView(edge1)); double t; RelativeEdgePosition pos = edge0.Intersect(edge1, out t); Point crossPoint = null; if (pos != RelativeEdgePosition.PARALLEL && pos != RelativeEdgePosition.COLLINEAR) { crossPoint = new Point(edge0.Point(t)); this.scene.Add(new PointView(crossPoint)); } }