public override void DrawSelf(Graphics grfx) { var radius = (int)Point4.X - (int)Point2.X; var rect = new Rectangle((int)Point2.X, (int)Point2.Y, radius, radius); var secondCenter = new PointF(Point2.X + radius / 2F, Point2.Y + radius / 2F); using (Pen pen = new Pen(base.BorderColor)) using (SolidBrush brush = new SolidBrush(FillColor)) { grfx.TranslateTransform(secondCenter.X, secondCenter.Y); grfx.RotateTransform(this.RotationAngleInDegrees); grfx.TranslateTransform(-secondCenter.X, -secondCenter.Y); grfx.DrawEllipse(pen, rect); grfx.FillEllipse(brush, rect); grfx.ResetTransform(); //grfx.DrawRectangle(pen, new Rectangle(new Point((int)secondCenter.X, (int)secondCenter.Y), new Size(2, 2))); foreach (var rotationDegree in this.CenterToRadiusPoints) { var next = new PointF(secondCenter.X, secondCenter.Y - radius / 2F); var list = new List <PointF>() { secondCenter, next }; var radians = PolygonHlp.ConvertDegreesToRadians(rotationDegree); var rotatedPoints = PolygonHlp.RotatePolygon(list, secondCenter, radians + this.RotationAngleInRadians); grfx.DrawLine(pen, rotatedPoints[0], rotatedPoints[1]); } foreach (var tuple in this.RadiusToraduisPoints) { var next = new PointF(secondCenter.X, secondCenter.Y - radius / 2F); var list = new List <PointF>() { secondCenter, next }; var radians = PolygonHlp.ConvertDegreesToRadians(tuple.Item1); var rotatedPoints = PolygonHlp.RotatePolygon(list, secondCenter, radians + this.RotationAngleInRadians); var firstRersultPoint = rotatedPoints[1]; next = new PointF(secondCenter.X, secondCenter.Y - radius / 2F); list = new List <PointF>() { secondCenter, next }; radians = PolygonHlp.ConvertDegreesToRadians(tuple.Item2); rotatedPoints = PolygonHlp.RotatePolygon(list, secondCenter, radians + this.RotationAngleInRadians); var secondResultPoints = rotatedPoints[1]; grfx.DrawLine(pen, firstRersultPoint, secondResultPoints); } } }
public override Shape NewShapeRotatedToRigth(float radians = GlobalConstants.RadiansRepresentationOfThirtyDegrees) { var listOfPoints = new List <PointF>() { this.Point1, this.Point2, this.Point3 }; var center = PolygonHlp.GetCentroidGeneric(new List <PointF>() { this.Point1, this.Point2, this.Point3 }); var rotatedPoints = PolygonHlp.RotatePolygon(listOfPoints, center, radians); return(new TriangleShape(rotatedPoints[0], rotatedPoints[1], rotatedPoints[2], this.BorderColor, base.FillColor)); }
public override Shape NewShapeRotatedToRigth(float radians = 0.5235988F) { var listOfPoints = new List <PointF>() { this.Point1, this.Point2 }; var center = PolygonHlp.GetCentroidGeneric(new List <PointF>() { this.Point1, this.Point2 }); var rotatedPoints = PolygonHlp.RotatePolygon(listOfPoints, center, radians); return(new LineShape(rotatedPoints[0], rotatedPoints[1], this.BorderColor, base.FillColor)); }