Hi,
I have a rectangle that has width 150mm and height 200mm. I also have a circle that is 200mm.
I've drawn the rectangle.
I'm trying to calculate how to draw an arc that is only the portion of the circle that can fit inside the rectangle.
I can do this manually with the code below, but I'm not sure how to calculate the start and sweep angle of the arc.
Example files of expected output -
https://we.tl/t-6RsQRG8qk7Code:
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsUnit.Millimeter);
XPen pen = new XPen(XColors.Black, 1); // Pen for drawing
// Rectangle properties
double rectWidth = 150;
double rectHeight = 200;
// Circle properties
double circleDiameter = 200;
gfx.DrawRectangle(pen, 10, 10, rectWidth, rectHeight);
gfx.DrawArc(pen, 10, 10, circleDiameter, circleDiameter, 60, 240); // Right straight side
gfx.DrawArc(pen, -40, 10, circleDiameter, circleDiameter, 240, 240); // Left straight side
const string filename = "TEST1.pdf";
document.Save(filename);