/// <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> /// Rotates this to the right about the origin provided. /// </summary> /// <param name="dAng">The angle through which to rotate.</param> /// <param name="Origin">The origin about which to rotate.</param> public override void RotateToRight(double dAng, C2DPoint Origin) { C2DVector vector = new C2DVector(Origin, this); vector.TurnRight(dAng); x = Origin.x + vector.i; y = Origin.y + vector.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)); }