vedderb / vesc_express

The source code for the VESC Express
GNU General Public License v3.0
39 stars 31 forks source link

Implement new arc drawing algorithm #5

Closed laxsjo closed 1 year ago

laxsjo commented 1 year ago

This includes a new pixel perfect algorithm for drawing arcs, circle sectors, and circle segments. This replaces the old algorithm that was based on approximating arcs as series of lines.

Dotted arcs still use the old algorithm however.

It also added a new function for the rounded attribute. It can now be used without any arguments for the img-arc function, as that function wound draw rounded line ends by default. It's only relevant when drawing non-filled arcs and not circle sectors or segments.

I admit that it's a bit confusing right now with it only working for arcs specifically, maybe this functionality should be expanded to cover more functions in the future?

There are still some minor rendering bugs left that I haven't covered yet. But I think it should be mostly fine.

Also changed the algorithm used for circles with a thickness to a similar one used for arcs, resulting in massive speedups for that case (~10 ms to ~2 ms).

Also changed the behaviour of the thickness attribute for most shapes to only extend inwards, instead of inwards and outwards equally, which resulted in a doubled total thickness. The only shapes that still have the old behaviour are img-triangle and img-line.

I also changed the behaviour of the the gradient drawing arguments to be more intuitive. You can read more in the documentation.

laxsjo commented 1 year ago

Just removed some comments I forgot to remove ;)