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

    Bezigon Tool

    Scheduled Pinned Locked Moved Features and Ideas
    36 Posts 5 Posters 9.8k Views 5 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.
    • DanielD Offline
      Daniel @VectorStyler
      last edited by

      @VectorStyler: In FreeHand, it is Alt Right-Click or more simply - Modifier-Right Click. This can't be changed in FreeHand. However, this is not friendly. We should be able to assign our own key combination.

      Whilst working through this, we stumbled upon an accidental behaviour which would be nice to have if possible. "Reset Handle Lengths" - this means you're able to click on a node at any time during the drawing and press R - to reset it to what the bezigon algorithm would have approximated it to when the node was first laid down.

      https://ibb.co/pjhS4tRF - Like so.

      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

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

        @Daniel I will make a new build with what I have now (may take a day or two).
        And then we can improve on that.

        Thanks a lot for the help!

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

          @VectorStyler: Please hang on. To spare you some effort, we've worked out every last bit of kink. Would you rather I give you the clean code for just the sharp, cusp and smooth node - ignoring Tangent Node? I have that ready to go. But tangent node conversions are turning into a devilishly tricky problem because converting a smooth/sharp node into a tangent depends very heavily on the neighbouring nodes. And this means, both the sequence of conversion and the type of neighbouring node matters. That is proving difficult. Seriously, I am so tempted to decompile and look into the FreeHand code. But I won't! FUCK ADOBE for not doing the right thing.

          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 @VectorStyler
            last edited by Daniel

            @VectorStyler What do you mean? FreeHand allows you to set every single point manually.

            80cfb849-6e0e-4fdf-a4c5-273d9452edff-image.png

            Those are the three types of points. Smooth, Sharp, and Tangent. And on the right you have the option to convert each of the sides a smooth node to a cusp node.

            For instance say you have a smooth node, with two symmetric handles. Pressing the left hand side handle button converts that portion of the shape into a straight line. When you press the right hand side handle button, the second handle also collapses, meaning you have a square node.

            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

            VectorStylerV 1 Reply Last reply Reply Quote 1
            • VectorStylerV Offline
              VectorStyler @Daniel
              last edited by

              @Daniel said in Bezigon Tool:

              What do you mean? FreeHand allows you to set every single point manually.

              Yes, with the Node tool.

              I meant if there is a way to set handles while drawing with the bezigon tool.

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

                @VectorStyler: Yes, FreeHand allows you to set each point manually. Plain click - Square node, Alt click - Smooth node, alt -right click - tangent node. Alternatively you can choose which nodes you want to place from the side panel shown in my previous comemnt.

                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 1
                • DanielD Offline
                  Daniel
                  last edited by

                  @vectorstyler: Okay, now I have both sets of clean code exhaustively tested.

                  Bezigon Code without Tangent Node implementation. About 200 lines of CPP code.

                  Bezigon Code with Tangent Node implementation and non-destructive node conversions - that is, toggling between tangent, cusp, and smooth retains the origin state. For instance, if I create a smooth node, then toggle it to cusp, and tangent, and then to smooth back again, I will return to the original state in which it was created. It is true of all 3 nodes. This is a major draw back in FreeHand too, because there was no way of predicting how changes affected the curve. Now, after 35 bloody years, it is refined. About 500 lines of CPP code. Tangent node handling makes it exponentially complex.

                  Question for you, dev: How should I hand you this code? What sort of documentation would you like?

                  We have written the code so that it is easy to integrate into any program without dependencies. But equally, everything - all the rules, conditional statements - are carefully documented within the code itself.

                  We have also written a test code to check the math of the code too.

                  What do you need from me? I have the whole history of the project including the permutation tables for all three nodes and click patterns.

                  Let me know. I'll package it and drop it. I am also giving the code to Inkscape and PhotoLine devs as part of MIT License. Just FYI.

                  I think if implemented correctly, it will the single most useful step up in the curve handling functionality in all three. The missing piece has always been the tangent node.

                  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

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

                    @Daniel Send me the code and the tables with click patterns

                    1 Reply Last reply Reply Quote 1
                    • M Offline
                      marce @Daniel
                      last edited by

                      @Daniel Sorry i miss a little all the conversation, because my english: Is possible to do this examples with VS now, or it is a suggestion for future development?
                      I tried with sample 1, i got this:

                      608d4616-55d3-4772-8a0f-8dd99ad6e6e1-image.png

                      I used click and alt+click.

                      Ryzen 9 3900X on Asus prime x570-p
                      Memory 48gb ddr4
                      Nvidia gtx 970 on an Asus strix, 4gb gddr5
                      NVMe CT100p 1TB

                      VectorStylerV 1 Reply Last reply Reply Quote 1
                      • VectorStylerV Offline
                        VectorStyler @marce
                        last edited by

                        @marce Should be possible to get those cases from the image.

                        I tested them, I will retest the final build and see if there might be some bugs.

                        Is there some reference app I can access to test these?

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

                          @VectorStyler: https://limewire.com/d/zsIgi#SZatmBEVLR - Here is the permutation table. You can see the exact curve that needs to be produced for all 16 click patterns. I've included screenshots from the algorithm I am working on as well as FreeHand's. You can compare results with VS, too. Code coming through. Just fixing API issues. Sorry for delay.

                          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

                          VectorStylerV 1 Reply Last reply Reply Quote 1
                          • VectorStylerV Offline
                            VectorStyler @Daniel
                            last edited by

                            @Daniel Thanks, I will try to use this as a reference.

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

                              @VectorStyler:

                              This is my giant, practical middle finger to Adobe! Fuck you, Adobe, for killing FreeHand.

                              It is here feckin' finally:

                              The Bezigon package is attached as Bezigon-packages.zip.

                              It contains two versions of the library and the documentation. You only need two files to integrate either version into Vectorstyler: bezigon.h and bezigon.cpp. Everything else is for testing, the demo, or reference.

                              Which version to use

                              Bezigon 4.2.0 has three node types: Corner, Smooth and Tangent.
                              Bezigon 2.2.0 has two: Corner and Smooth. It is about half the size.

                              On paths made only of Corner and Smooth nodes, the two versions give identical handles. Use 4.2.0 if VectorStyler needs Tangent nodes. I highly recommend it. Otherwise 2.2.0 is the simpler choice.

                              The permutation documents appear in both version folders and in Technical Documentation. The copies are identical, and the duplication is deliberate so each folder stands alone.

                              What each file does

                              • bezigon.h is the public interface: the node types, make_node, close_path, set_node_type, compute_handles, drag_handle, and in 4.2.0 segment_is_straight and handle_axis.

                              • bezigon.cpp contains all the rules. It depends only on the standard C++ headers <vector> and <cmath>, and has no global state, I/O or exceptions.

                              • main.cpp is an interactive demo that runs on Windows with the EGE graphics library. It shows how the functions are called and lets you test every gesture. It is not part of the product.

                              • demo_scenes.h (4.2.0 only) holds seven example paths, used by the demo keys 1 to 7 and by the tests.

                              • test_bezigon.cpp is the test program. It needs no window and checks the rules across thousands of cases. Build it with the same compiler and flags as VS to confirm the results match on your toolchain. Expected results are in the README.

                              • The permutation documents show every combination of node types, closes and edits, with a picture for each case. The Corner, Smooth and Cusp document covers both versions. The Tangent document covers 4.2.0 only.

                              • The Technical Reference is the document to read first. It covers the API, the rules, the VectorStyler integration steps, and how degenerate input is handled. The History and Derivation explains how each rule was reached: the formulas, the FreeHand and Xara comparisons, and where we overrode FreeHand for intuitiveness.

                              • README.md is a short overview with the test commands and a manual checklist for the demo.

                              Further note: You will see PhotoLine addressed throughout because we wrote it with the intention of initially just giving it to PhotoLine, but then changed our minds. So ignore this. The code is software agnostic.

                              How we used AI: We used AI extensively to test and debug the code we wrote. The model used was Claude Opus 5.5. We used AI extensively to derive formulas from screenshots. This is well documented within the history and derivation document. AI was used to create permutation tables which we then checked against FreeHand. AI was also used to give structure to our original brain dump and produce read me files, and technical references. The code itself was hand written by two extremely patient human beings: Vira Daniel & his long-suffering mate Taras Vynnychenko who obliged me with this mammoth project. He wrote this while he and his neighbours are still under Russian occupation. I wrote zero code. But I provided the complete creative direction to the entire project.

                              Edit: Permutation tables will be updated with exhaustive screenshots: Its partially filled because I got tired and lazy. But I have checked every single instance in FreeHand.

                              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 1
                              • First post
                                Last post