# Bezier Curve Tool Controlled by Mouse

So I have recently learned about Bezier Curves (quadratic & cubic) and have a thorough knowledge of how they work. In my graphics engine in DirectX I wanted to implement a Bezier Curve Tool exactly like the Pen Tool in Adobe Illustrator. I understand the basic computation of the curve but I am puzzled as to how I can get mouse interaction involved.

Basically I'd like to draw Bezier Curves with a Mouse.

• I suspect that, like myself, many of us don't have Illustrator, so you'll have to be more specific in your description. Are you just clicking to define the end points of the each curve segment and then moving the end point(s) of the tangent associated with an end point? Commented Oct 14, 2016 at 8:19
• It's really hard to explain what I mean but I think if you watch this video from 2:11 to 3:00 you'll understand exactly what I'm trying to say. youtu.be/0B_IQK7hMo0?t=2m8s Commented Oct 14, 2016 at 9:53
• How your program interacts with your software depends on your GUI framework. Surely your windowing library has some tools for implementing mouse clicks. That in essesnce is not a graphics problem altough drawing pick buffers might be. Commented Oct 14, 2016 at 10:16
• Detecting Mouse Clicks isn't an issue but if you watch this video you'll understand what I'm trying to say youtu.be/0B_IQK7hMo0?t=2m8s watch from 2:11 to around 3:00. If you notice the technique in which he draws, when he still holds his mouse down after the click he can tune the curve just by moving the mouse. That is basically what I am trying to implement... Commented Oct 14, 2016 at 10:23
• I might be wrong, but I think you basically just add a control point at each extremity of your "pen tool" Commented Oct 14, 2016 at 10:32

Instead of using cubic Bezier spline, you should use cubic Hermite spline. For cubic Hermite curve you specify the segment end points and tangents, which is what you then control in the tool. Hermite spline is almost the same as Bezier spline but with different $B$ matrix, so if you already understand Bezier, then understanding Hermite is a trivial step.