//////////////TRANSFORM_METHODS//////////////// /////////////////////////////////////////////// /////////////INTERSECTION_METHODS////////////// public override GlPointR2[] getIntersection(GlCurve C) { if (C == null || C.CountOfPoints == 0) { return new GlPointR2[] { } } ; List <GlPointR2> Intersections = new List <GlPointR2>(); bool Side = this.isPointInside(C[0]); for (int i = 1; i < C.CountOfPoints; i++) { if (this.isPointInside(C[i]) != Side) { int next = (i == C.CountOfPoints - 1) ? 0 : i + 1; int prev = i == 1 ? C.CountOfPoints - 1 : i - 2; GlPointR2[] faultInter = this.getIntersection(new GlLineR2(C[i], new GlVectorR2(C[next].X - C[prev].X, C[next].Y - C[prev].Y))); for (int k = 0; k < faultInter.Length; k++) { if (C.isPointBelongs(faultInter[k])) { Intersections.Add(faultInter[k]); Side = !Side; } } } } return(Intersections.ToArray()); }
/// <summary> /// Determines the intersection of a point and a parabola /// </summary> /// <returns>An array containing a copy of given point if it belongs to the parabola</returns> public override GlPointR2[] getIntersection(GlCurve C) { return(C == null ? new GlPointR2[] { } : C.getIntersection(this)); }
/// <summary> /// Determines an anmount of points, created by intersection of a figure and an oval /// </summary> /// <returns>An array of intersections</returns> public abstract GlPointR2[] getIntersection(GlCurve C);