/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.HitTest (ref BoundingRect, bool)"/> /// </summary> /// <param name="Rect"></param> /// <param name="IncludeControlPoints"></param> /// <returns></returns> public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { Angle majorang = majorAxis.Angle; double radiusx = majorAxis.Length; double radiusy = minorAxis.Length; ClipRect clr = new ClipRect(ref Rect); if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 0, right, top)) { return(true); } if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 1, top, left)) { return(true); } if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 2, left, bottom)) { return(true); } if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 3, bottom, right)) { return(true); } return(false); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.HitTest (ref BoundingRect, bool)"/> /// </summary> /// <param name="Rect"></param> /// <param name="IncludeControlPoints"></param> /// <returns></returns> public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { Angle majorang = majorAxis.Angle; double radiusx = majorAxis.Length; double radiusy = minorAxis.Length; ClipRect clr = new ClipRect(ref Rect); if (clr.Contains(startPoint)) { return(true); } if (clr.Contains(EndPoint)) { return(true); } for (int q = 0; q < 4; ++q) { GeoPoint2D ps; GeoPoint2D pe; switch (q) { default: // nur wg. Compiler case 0: ps = right; pe = top; break; case 1: ps = top; pe = left; break; case 2: ps = left; pe = bottom; break; case 3: ps = bottom; pe = right; break; } if (Sweep > 0.0) { if (crossingZero) { if (q < startQuad && q > endQuad) { continue; } } else { if (q < startQuad || q > endQuad) { continue; } } if (crossingZero && startQuad == q && endQuad == q) { // zwei Tests nötig GeoPoint2D p = endPoint; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, ps, p)) { return(true); } p = startPoint; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, p, pe)) { return(true); } } else { if (startQuad == q) { ps = startPoint; } if (endQuad == q) { pe = endPoint; } if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, ps, pe)) { return(true); } } } else { if (crossingZero) { if (q < endQuad && q > startQuad) { continue; } } else { if (q < endQuad || q > startQuad) { continue; } } if (crossingZero && startQuad == q && endQuad == q) { // zwei Tests nötig GeoPoint2D p = startPoint; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, ps, p)) { return(true); } p = endPoint; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, p, pe)) { return(true); } } else { if (startQuad == q) { pe = startPoint; } if (endQuad == q) { ps = endPoint; } if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, q, ps, pe)) { return(true); } } } } return(false); }