VectorStyler
    • Categories
    • Unread
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Bezigon Tool

    Scheduled Pinned Locked Moved Features and Ideas
    86 Posts 8 Posters 10.1k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • signalwerkS Offline
      signalwerk @Daniel
      last edited by

      @Daniel Thank you for all your work and the effort you put into reverse engineering this. That’s really awesome! I was very interested in its behaviour and what it feels like to work with, so I used Claude AI to create a small playground with your code. You can find it here.

      You mentioned a new revision of the code, and I would be very interested in incorporating that as well. Would we be able to get it somewhere?

      Since your code has already made its way into discussions in PhotoLine and Inkscape, I think it would be great to have a central place to get the latest version. I would love to see the code on GitHub, a platform for version control, so we can all access it there and know where to find the latest original source.

      DanielD 2 Replies Last reply Reply Quote 2
      • DanielD Offline
        Daniel @signalwerk
        last edited by Daniel

        @signalwerk: Thanks! Since I released that code, the code has gone through a huge churn cycle. We had to strip and rebuild. Not because the logic is wrong. It is perfectly usable. But because we had a new idea. Tangent node is really not a separate node, but a cusp node with handle locked to chord. The idea is as simple as it is obvious. The implementation however is a whole new monster. Because, now you have to figure out how is this lock going to work.

        We use De Casteljau algorithm to preserve shape when inserting new node on existing shapes. But then locking is a unique case. So we had work out every single on of these cases manually. By hand. FreeHand is of no use here. Because FreeHand does not preserve shape. It brutally applies a tangent node with both handles instantly available. That is not intuitive or even purposeful. So after 10 further iterations of back and forth, we discovered the solution. It is simple too:

        Locked node ALWAYS gives precedence to a sharp node's chord when a smooth neighbour is present. Where both neighbours are either square or locked or combination of the two, the locked node in between them has no handle automatically. If a manual handle is draw out, this gets preserved in subsequent operations.

        This is our labour of love and addition to 40 year old Bezigon algorithm.

        However, there's something even more interesting we've done.

        We built a drag gesture layer which allows you to drag nodes, handles and segments using modifiers. Alt to break, Ctrl to unite. This will become obvious when people actually try it. These gestures are actually native to PL. We built it for the benefit of PL devs who have to integrate it into the program. So we wanted to show them how Bezigon can sit perfectly alongside their existing gestures model.

        But then, we realised that in the process of doing this, we had created a dependancy! FUCK!

        Now anyone who wanted to implement in must also implement these gestures. So another round: We created two layers. Geometry layer. Drag gesture layer. Completely separate as headers and algorithms. You can strip out gestures without losing a thing.

        https://drive.google.com/file/d/1BDM-JtO3t5E3_iCCTFpNOw5Xa4DwZwM-/view?usp=sharing - Here's the new demo file. You can download, play and enjoy. You will get a warning on Windows. No digital signature. Ignore it. It's safe. PRESS D to see the handles. Forgot to add. K for clamp. C/S/L for toggling between Cusp, Smooth and Locked. G for Ghost Lines. O for True Circle. R for reset to Bezigon Handles. Ctrl + Z/Y for Undo/Redo. Esc to Clear Canvas. Enter or Alt Click to finish drawing curve.

        We've also included Clamp, True Circle and Ghost Lines as options. Clamping exists for extremely close nodes which have enormous handles. Clamp makes sure that the length of the handle is not greater than either 2 or 5 times greater than distance between the nodes. True circles is basically a subset of Bezigon. It overrides Bezigon and approximates true circles like Spiro Path does.

        So you have enormous flexibility built directly into the algorithm, which I hope @vectorstyler implements as options for bezigon.

        Final note: EGE, the Open Source engine that we used before was not sufficient. So we rewrote the demo in Raylib. Well, my colleague did.

        It works wonderfully. And we also took AI's help (GLM this time) to write an exhaustive test suite. Covering millions of paths. And we compared this with FreeHand.

        The deviation is 0.0008%. Because FH uses 0.3899994 as the approximating constant.

        At this point, my autistic, perfectionistic streak is completely satisfied. Please give me a kiss (applause) of appreciation. I am tired now. I've gotten this monkey off my back. Thank you!

        I'll share the full code base after documentation is done. There's a lot to rewrite.

        Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
        Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

        BoldlineB 1 Reply Last reply Reply Quote 2
        • DanielD Offline
          Daniel @signalwerk
          last edited by

          @signalwerk said in Bezigon Tool:

          code on GitHub, a platform for version control, so we can all access it there and know where to find the latest original source.

          I don't know how to use it. I'd rather not create an account either. One less account. I am happy to hand you the complete code with documentation. You're free to post it there if you want. Since its under MIT anyone can use it permissively.

          Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
          Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

          1 Reply Last reply Reply Quote 0
          • BoldlineB Offline
            Boldline @Daniel
            last edited by

            @Daniel Sounds really impressive! Forgive my naiveté, but it sounds like this could be applied to the pen tool as well

            🍎 macOS Tahoe 26.2, Mac mini (M1, 2020), Chip Apple M1, Memory 16 GB
            Cintiq 27QHD Display and LG Ultra HD Display

            DanielD 1 Reply Last reply Reply Quote 1
            • DanielD Offline
              Daniel @Boldline
              last edited by

              @Boldline: What specifically? Bezigon algorithm to Bezier pen tool? Because while it is tempting to group them together, they're actually complementary, rather than same. Bezigon does precisely what Bezier pen tool cannot do. Automatic approximation of curves.

              If you mean clamping and true circle, yes, you could do that. Because you can draw a curve, and the true circle option would basically force it into an arc.

              Have a play with it first of all. I think you'll really like it.

              Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
              Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

              1 Reply Last reply Reply Quote 2
              • DanielD Offline
                Daniel @Daniel
                last edited by

                dcfc2c0a-9361-4499-b853-10756a5215f2-image.png

                So happy! I drew that in 10 seconds! Notice them little locks. So cute.

                Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
                Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

                signalwerkS BoldlineB DanielD 3 Replies Last reply Reply Quote 1
                • signalwerkS Offline
                  signalwerk @Daniel
                  last edited by

                  @Daniel Thank you for your explanation and your work! That all sounds super exciting. Since I don't have a Windows computer, I can't run your test, but I will definitely have a look at the new code and probably adapt the online editor I made to the new version.
                  I understand that you don't want to open a GitHub account. It was just a suggestion to maximise the impact. But now that I've found this thread, I'll follow along here.

                  1 Reply Last reply Reply Quote 1
                  • BoldlineB Offline
                    Boldline @Daniel
                    last edited by

                    @Daniel I tried the bezigon playground simulator. The key commands for each type of node felt very natural; smooth with a shift-click, tangent with a control-click, a corner with the regular click and no modifier. I'd love to see the bezigon tool set up this way in VS

                    🍎 macOS Tahoe 26.2, Mac mini (M1, 2020), Chip Apple M1, Memory 16 GB
                    Cintiq 27QHD Display and LG Ultra HD Display

                    DanielD 1 Reply Last reply Reply Quote 2
                    • DanielD Offline
                      Daniel @Boldline
                      last edited by

                      @Boldline: Did you try the true circle mode? You can toggle that on along with ghost lines. Now you'll get circular arcs instead of Bezigon approximations. Like in Spiro. 🙂

                      Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
                      Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

                      BoldlineB 1 Reply Last reply Reply Quote 0
                      • BoldlineB Offline
                        Boldline @Daniel
                        last edited by

                        @Daniel How do I turn on true circle and ghost mode in the simulator website version?
                        Also, it would be cool if the examples to trace and follow could remain on screen at a low opacity view to trace over instead of disappearing
                        Another thought on the bezigon tool, especially for type design: should we add the ability to constrain Bézier handles to the horizontal and vertical axes, snapping to 90° increments? Thought of it when looking at your example of an "n" shape and some of the handles were not straight (I understand it was a fast rough example you made)

                        7b76dfcc-be28-4c59-8889-db94dcfa6c16-CleanShot 2026-10-28 at 10.49.28 AM.png

                        🍎 macOS Tahoe 26.2, Mac mini (M1, 2020), Chip Apple M1, Memory 16 GB
                        Cintiq 27QHD Display and LG Ultra HD Display

                        1 Reply Last reply Reply Quote 0
                        • DanielD Offline
                          Daniel @Daniel
                          last edited by Daniel

                          said in Bezigon Tool:

                          dcfc2c0a-9361-4499-b853-10756a5215f2-image.png

                          So happy! I drew that in 10 seconds! Notice them little locks. So cute.

                          @boldline: Notice the buttons at the top. Toggle it on. Also, unless you exaggerate the curves, you won't see the true circle just yet. Because Bezigon already very closely follows circle arcs.

                          Angle constraint for handles. Yes. I assume it will be already a part of VS. So did not add it. Also, there should no node drawing mode where only handle are visible. It means you won't accidentally move the node.

                          Additionally, top of locking node handle to chord. A very useful option, already proposed before, is the ability to lock node coordinate position. So you don't accidentally move a certain set of nodes.

                          Yes, my n was just a very swift drawing. If I spent a few more minutes, I can get it right. Also, there's no ruler, no guide, no snapping in demo. In VS, all these auxiliary tools would make it supremely fast, as you can place 45 degree points perfectly.

                          Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
                          Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

                          BoldlineB 1 Reply Last reply Reply Quote 1
                          • BoldlineB Offline
                            Boldline @Daniel
                            last edited by

                            @Daniel I'm not seeing those options to toggle at the top (or anywhere). is there something I have to press or do?

                            c034001b-e4c5-4cde-98e6-7ccab3903601-CleanShot 2026-10-28 at 11.11.17 AM.png

                            🍎 macOS Tahoe 26.2, Mac mini (M1, 2020), Chip Apple M1, Memory 16 GB
                            Cintiq 27QHD Display and LG Ultra HD Display

                            DanielD 1 Reply Last reply Reply Quote 0
                            • DanielD Offline
                              Daniel @Boldline
                              last edited by Daniel

                              @Boldline: That's not mine. That was done by another user. https://drive.google.com/file/d/1BDM-JtO3t5E3_iCCTFpNOw5Xa4DwZwM-/view?usp=sharing - Mine is here. 🙂 It's a .exe file on Windows.

                              The online one runs the 4.2.0 V with three node system. There's no ghost lines or circle mode.

                              Work: Windows 11 | Intel i9 14900HS (24 Cores/32 Threads) | GeForce RTX 4070 | 64 GB RAM
                              Personal: Windows 11 | Amd Ryzen 9 7950X (16 Core, 32 Threads) | GeForce RTX 3060 | 32 GB RAM

                              BoldlineB 1 Reply Last reply Reply Quote 0
                              • BoldlineB Offline
                                Boldline @Daniel
                                last edited by

                                @Daniel oh! ok. I'll try it when I get my windows laptop out thank you!

                                🍎 macOS Tahoe 26.2, Mac mini (M1, 2020), Chip Apple M1, Memory 16 GB
                                Cintiq 27QHD Display and LG Ultra HD Display

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post