/// <summary> /// Returns the corresponding circle's centre. /// </summary> public C2DPoint GetCircleCentre() { if (!IsValid()) { return(new C2DPoint(0, 0)); } C2DPoint MidPoint = new C2DPoint(Line.GetMidPoint()); double dMinToStart = MidPoint.Distance(Line.point); double dMidToCentre = Math.Sqrt(Radius * Radius - dMinToStart * dMinToStart); C2DVector MidToCentre = new C2DVector(Line.vector); if (CentreOnRight) { MidToCentre.TurnRight(); } else { MidToCentre.TurnLeft(); } MidToCentre.SetLength(dMidToCentre); return(MidPoint.GetPointTo(MidToCentre)); }
/// <summary> /// Returns the projection of this onto the vector provided, given as the interval on /// (or off) the vector. Interval given as distance from the start of the vector. /// The vector is equivalent to a line from (0, 0). /// </summary> /// <param name="Vector">The projection vector.</param> /// <param name="Interval">The interval to recieve the result.</param> public override void Project(C2DVector Vector, CInterval Interval) { C2DArc ThisCopy = new C2DArc(this); C2DVector VecCopy = new C2DVector(Vector); double dAng = VecCopy.AngleFromNorth(); VecCopy.TurnLeft(dAng); ThisCopy.RotateToRight(-dAng, new C2DPoint(0, 0)); C2DRect rect = new C2DRect(); ThisCopy.GetBoundingRect(rect); Interval.dMax = rect.GetTop() - VecCopy.j; Interval.dMin = Interval.dMax; Interval.ExpandToInclude(rect.GetBottom() - VecCopy.j); }
/// <summary> /// Returns the projection of this onto the vector provided, given as the interval on /// (or off) the vector. Interval given as distance from the start of the vector. /// The vector is equivalent to a line from (0, 0). /// </summary> /// <param name="Vector">The projection vector.</param> /// <param name="Interval">The interval to recieve the result.</param> public override void Project(C2DVector Vector, CInterval Interval) { C2DArc ThisCopy = new C2DArc(this); C2DVector VecCopy = new C2DVector(Vector); double dAng = VecCopy.AngleFromNorth(); VecCopy.TurnLeft(dAng); ThisCopy.RotateToRight( -dAng, new C2DPoint(0, 0)); C2DRect rect = new C2DRect(); ThisCopy.GetBoundingRect( rect); Interval.dMax = rect.GetTop() - VecCopy.j; Interval.dMin = Interval.dMax; Interval.ExpandToInclude( rect.GetBottom() - VecCopy.j ); }
/// <summary> /// Returns the corresponding circle's centre. /// </summary> public C2DPoint GetCircleCentre() { if (!IsValid() ) return new C2DPoint(0, 0); C2DPoint MidPoint = new C2DPoint(Line.GetMidPoint()); double dMinToStart = MidPoint.Distance( Line.point); double dMidToCentre = Math.Sqrt( Radius * Radius - dMinToStart * dMinToStart); C2DVector MidToCentre = new C2DVector(Line.vector); if ( CentreOnRight) MidToCentre.TurnRight(); else MidToCentre.TurnLeft(); MidToCentre.SetLength(dMidToCentre); return (MidPoint.GetPointTo(MidToCentre)); }