Skip to content

Back on track

Posted on:June 9, 2023

First and foremost, I finally fixed the bug I had with ellipses and merged that code in! It was a small copy error (I should have written a2 but I went with a1). So it forced me to redo all the math leading to that value to figure out what was wrong!

Typescript and multiple entry points

I want the pantograph API to be layered - to offer new users a nice clean high level API to do make the common things simple. But you know what the second part is - I want to make the uncommon and difficult things possible - to offer access to lower level stuff.

The way that I approached this is to offer different entry points in the library. import {whatever} from "pantograph2d" should be exposed as the default for anyone using the high level functions. But you should be able to import {algo} from "pantograh2d/algorithms".

By separating entry points you give the new user a clue about what are the things that they can use without too much knowledge and what is a bit more involved.

But this is not the original philosophy of Typescipt which used not to support this type of import. With this and the relatively recent introduction of the export key in package.json the tooling it is a bit painful to make work right now.

The good new is that I finally made it work! So now the dielines is its own package (yeah!) and I am ready to import pantograph from replicad and make them work together.

Back into maths

But I still want to have “full SVG support” before integrating pantograph and replicad. So I am back in math land to learn a bunch of things about Bézier curves.

I originally thought I would just import bezier.js and wrap it, it does not look like it will cut it for me. Some functionality (isOnSegment) is not implemented and some of the algorithms seem to focus on giving a result good for presentation but probably not good enough for technical drawing.

But this is a great source to start and learn what I want to do and how to improve on what is there.

Discussing licences

For replicad (and pantograph) I decided to publish my code with an AGPL license with a CLA (contributor licence agreement).

People on Mastodon have noted that this is not a very open way of sharing the code. AGPL is not very business friendly (as it is a viral licence). CLA are not very contributor friendly - they give me a full licence to do what I want with their code.

The danger with this is that replicad (and pantograph) will not grow in community (no big contributors outside of myself) and in usage (no interest for professional use, low bus factor because of a lack of a developer community).

So why not use something more permissive (MIT or ISC for instance)? My original thought was to have a licence that would let people use the code, but encourage businesses to buy a commercial licence. This is for instance the model which CGAL, the main library used by OpenSCAD, is published under.

In order to be able to offer a commercial licence, I need to have a licence to do that from potential contributors (from my understanding of how this whole thing work).

This being all said, I have not received so far any inquiries for commercial licences - so I might be in a situation without a solution. I can try to grow the project by making it more open. It might lead to commercial users - but they will not need to pay me anything. Or I can keep it the way it is now, but the project might not grow (and no money back to me in either case).

So what’s the plan now? The current situation gives me full control over the licence. But once I change the license to something more permissive there is no way back. So my plan is to wait for a little bit longer (until the end of the year for instance) and revisit what I want to do then.