Drawing an ARC on the WebCanvas

Just out of interest.

How would you draw an arc on the web canvas because you can only draw a filled-ellipse | filled rectangle?

I Want to explore all the different ways you can create shapes on the canvas without pushing pictures to the browser.

Thanks for any input or advice.

You draw an arc with multiple lines; the smoothness of the arc depends on the number of small lines (segments).
an arc is defined by is center, the radius, the start angle and the end angle.
a line is defined by the start point and the end.

Dim fx as New FigureShape endAngle = startAngle + 0.017 '(degree2radian) startPt.x = center.x + radius*cos(startAngle) startPt.y = center.y + radius*sin(startAngle) endPt.x = center.x + radius*cos(endAngle) endPt.y = center.y + radius*sin(endAngle) fx.AddLine(startPt.x, startPt.y, endPt.x, endPt.y) startPt = endPt startAngle = endAngle endAngle = startAngle + .,017 '(degree2radian) startPt.x = center.x + radius*cos(startAngle) startPt.y = center.y + radius*sin(startAngle) endPt.x = center.x + radius*cos(endAngle) endPt.y = center.y + sin(endAngle) fx.AddLine(startPt.x, startPt.y, endPt.x, endPt.y) '... g.DrawObject(fx, 100, 100)

'you can put that in a for…next loop
Also, you can take a look at the ArcShape doc.

I did not implement the code but it should be something like that.

jjc_Mtl

Thanks Jean-Jacques

I Have come across a similar solution but the WebCanvas does not allow g.DrawObject.

So, what about g.DrawPolygon() ?
jjc_Mtl

[quote=355980:@Jean-Jacques Chailloux]So, what about g.DrawPolygon() ?
jjc_Mtl[/quote]

Thanks mate. It would be a bit easier to draw an Arc than to calculate and draw mathematical equations of a complex shape. If that is the only way maybe It is better to work directly with the HTM5 canvas. I Was hoping there would be a bit more flesh on the Webcanvas than just very basic primitives.