public static BezierCurve FromEllipse(Point center, Size radius) { var pt1 = new Point(0, radius.Height); // top var pt2 = new Point(radius.Width, 0); // right var pt3 = new Point(0, -radius.Height); // bottom var pt4 = new Point(-radius.Width, 0); // left double dx = radius.Width * 4.0 * (System.Math.Sqrt(2) - 1) / 3; double dy = radius.Height * 4.0 * (System.Math.Sqrt(2) - 1) / 3; var curve_control_points = new [] { pt1, pt1.Add(dx, 0), pt2.Add(0, dy), pt2, pt2.Add(0, -dy), pt3.Add(dx, 0), pt3, pt3.Add(-dx, 0), pt4.Add(0, -dy), pt4, pt4.Add(0, dy), pt1.Add(-dx, 0), pt1 } .Select(p => p + center).ToArray(); var curve_Degree = 3; var curve = new BezierCurve(curve_control_points, curve_Degree); return curve; }
public VisioAutomation.Drawing.Rectangle GetRectangle() { var pin = new VisioAutomation.Drawing.Point(this.PinX, this.PinY); var locpin = new VisioAutomation.Drawing.Point(this.LocPinX, this.LocPinY); var size = new VisioAutomation.Drawing.Size(this.Width, this.Height); return(new VisioAutomation.Drawing.Rectangle(pin - locpin, size)); }
public static void AreEqual(double width, double height, VADRAW.Size actual_size, double delta) { Assert.AreEqual(width, actual_size.Width, delta); Assert.AreEqual(height, actual_size.Height, delta); }
public Point Subtract(Size s) { var new_point = new Point(this.X - s.Width, this.Y - s.Height); return new_point; }
public Point Add(Size s) { var new_point = new Point(this.X + s.Width, this.Y + s.Height); return new_point; }
public Point Multiply(Size s) { var new_point = new Point(this.X*s.Width, this.Y*s.Height); return new_point; }
public Rectangle Subtract(Size s) { var r2 = new Rectangle(Left - s.Width, Bottom - s.Height, Right - s.Width, Top - s.Height); return r2; }
public Rectangle Add(Size s) { var r2 = new Rectangle(Left + s.Width, Bottom + s.Height, Right + s.Width, Top + s.Height); return r2; }
public Size Add(Size size) { return new Size(Width + size.Width, Height + size.Height); }
public static void AreEqual(double x, double y, VADRAW.Size p, double delta) { Assert.AreEqual(x, p.Width, delta); Assert.AreEqual(y, p.Height, delta); }