2
$\begingroup$

There are plenty of libraries around allowing to draw Bézier paths, but not that much information about how to implement one of those libraries.

The question is: What algorithms are used for drawing Bézier paths?


Current work:

Searching on Internet, I found many documents about drawing Bézier lines (unfilled) using segments. This is obviously not enough.

I implemented a pointInsideBezierPath function, it actually solve the equations in the standard algebraic way. Even if that could work on a GPU, I am concern about efficiency for drawing large Bézier with anti-aliasing.

I also had a look to convert the shape into triangles for fast drawing with the GPU.

To summarize, there are solutions, but I wonder which is the modern state of the art to this respect.


Edited:

What are your requirements? How large are paths? What degree? What continuity?

Requirements: Well, setting requirements without understanding technical limits is not a good deal, but I guess the typical ones:

  • A Path is an ordered list of Bezier curves.
  • A Path is rendered by a stroke and a fill. Each accepting multiple rendering properties (color, gradients, etc.)
  • Rendering must allows anti-aliasing.
  • Joining point between bezier are limited only by it position
  • Rendering is limited by the rectangular and discrete size of the surface.

Size of Paths: any, performance is obviously affected. Degrees: lines to cubic (1-3)

I thought that recent GPU have it as built-in.

Not that I know about.

BTW if you need some actual code then your question is off-topic here.

I know, I deliberately asked here and not in stackoverflow because I do not want code (way to broad anyway) but algorithms names, papers and comparisons.

$\endgroup$
  • $\begingroup$ Did you look at the Cairo graph. library ? $\endgroup$ – TEMLIB Jun 20 '17 at 19:39
  • $\begingroup$ No, should I read it source code? $\endgroup$ – Adrian Maire Jun 21 '17 at 4:58
  • 1
    $\begingroup$ From nvidia Bezier path $\endgroup$ – Evil Jun 21 '17 at 6:06
  • 1
    $\begingroup$ Well, if you edit the question, the "Edited" is not needed in the post. I asked some questions, and thank you for the reply and edit, but now I am a bit lost. You want to know about the drawing algorithms. So I assume thah there are various methods, like de Casteljau split, and the linearization to draw flat enough segments, FDX. With GPU some techniques and built-ins the evaluators $\endgroup$ – Evil Jun 26 '17 at 20:27
  • 1
    $\begingroup$ But with the GPU and triangulation, then antialiasing it hints that it is a bit implementation detail. Otherwise there is a small pipeline that I am aware of -> clip, subdivide, render segments with e.g. Wu algorithm. Or a bit modified Murphy (the one I use) for variable width segments. It differs from GPU, where actual implementation is not transparent to the user and from patches, which are either triangulated by hand or by evaluator. If by filled path you do not mean patch (like surface) but thick enough curve with gradient probably triangulated rendering is the fastest technique. $\endgroup$ – Evil Jun 26 '17 at 20:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.