How I used linear algebra to build an interactive diagramming editor
medium.com
medium.com
Very slick look and feel :D
And it doesn't boast about it, but it's open source https://github.com/ishubin/schemio
1. a basic open source one you can self-host,
2. and another closed-source one with accounts and other features that schem.io uses?
And (I'm just thinking out loud, and don't want to encourage any development as I am not a real user) is there a server-less embeddable version that perhaps just saves/loads locally with a javascript API for use in other apps?
1. Self-hosted, there is even a docker container available (https://hub.docker.com/r/binshu/schemio/tags). It does not have authorization and user-management, stores all diagrams on a file system. But it allows you to run server in write and read-only mode
2. https://schem.io - a service for collaborative editing and sharing of diagrams. This is obviously a closed-source for now and it uses the open-source frontend of Schemio
3. Schemio as a js library. Although I am not really releasing it to npm, just hadn't the time to work this out. But there is an option to build a js lib that lets you use Schemio as a Vue component. That's actually how I made it work on https://schem.io
4. https://schemio.app - Google Drive based frontend. All your diagrams are stored on Google Drive. Obviously you cannot share your diagrams, as they are only available to you. This is completely open-sourced and you can even build it yourself with npm
5. Static deployment. If you use option 1, you can export all of your diagrams into a static deployment and even host it on Github pages.
6. Standalone player of Schemio that lets you embed a single diagram on your website
Hats off to you for getting as far as you have, and don’t sweat the stuff you haven’t been able to get to yet. Nobody (hopefully) expects you to freely share the code you write in any sort of expected time frame.
These things take as long as they take :)
If that's what you mean, then no. I do have plans to work on this in the future, but I am not sure when I'll get the time for that.
Or do you mean just generating a diagram and posting it to Schemio programatically? This is possible, but it's not documented.
All diagrams are stored in JSON by the way and the structure is quite straightforward, so it shouldn't be too difficult to generate it yourself
If you go to edit mode and select the "Ball" object (in the top hiearchy), then go to behavior panel, you will find that it has a "script" action in the "Play" event. You can take a look at how I implemented that scene and perhaps get some insights for yourself.
Also I had a small section about SchemioScript in this article: https://medium.com/@ivan.ishubin/interactive-diagrams-for-co...
I use it when I need to build complex templates or interactive learning demonstrations like on Brilliant. For example a friend of mine is preparing similar interactive demos with Schemio for kids at school.
Another thing that Schemio has is the concept of classes, functions and arguments bindings. Unfortunately I did not have a chance to write an article or prepare a video for this. But the idea is that you can prepare a class, with complex behavior and even its own configurable arguments, and then you can select any object on the scene and specify that it uses that class. Again, I don't know your exact situation, but just laying out the options
If you want open source alternatives, I remembered seeing now a little while ago this https://blog.eowyn.net/netlistsvg/ but never tried it myself, you might give it a go.
https://personal.math.ubc.ca/~cass/graphics/text/old.pdf/las...
https://scientificgems.wordpress.com/2014/11/28/mathematics-...
Don’t you just learn transformation matrices in algebra?
Affine transforms are apparently attributed to Mobius and Gauss. That’s like the 1700s.
What is vector based 2D graphics if not a direct application of geometry? Were we not using well known maths results when 2D graphics was first implemented on a computer?
We were, but in high school, they aren't teaching you computer graphics, they're teaching you how to apply weirdly specific rules to transform some scribbles into more scribbles, for no good reason - hence the common student question, "what will I ever need that for?".
FWIW, I actually got into gamedev as a hobby as a kid, and it saved my life prospects, because it gave me a reason to be interested in trigonometry and algebra - all those random scribble transformation rules were directly applicable to problems relevant to me, such as "how do I rotate the bitmaps that are spaceships and rockets and turrets?", and such.
Also, if you wanted to, you could juice up your discussion of the importance of performing transformations in the right order to introduce the idea of conjugates (https://en.m.wikipedia.org/wiki/Inner_automorphism) and commutators (https://en.m.wikipedia.org/wiki/Commutator). Although in your context introducing these explicitly might just make the exposition more complicated, they are useful tools to have in your general toolkit. (Conjugacy in particular, as you implicitly discuss, is practically built to express the idea "change from inconvenient coordinates to convenient ones, transform in convenient coordinates, then change back.")
But don't all editors use linear algebra?
Also another point is that, if you rely on SVG for rendering you could get away with just the code without thinking too much about the math involved. For instance if I wouldn't have introduced object hierarchy, I wouldn't even have to bother with math at all. SVG can take care of all the transformations, I wouldn't even have to know that matrices exist and that I could use them in svg objects 1-on-1. Dragging an object without a hierarchy would also propably be much easier, all I had to do is to change the translate(x,y) inside of the svg transform attribute.
Alas, I have not found a web equivalent that works as well as QGVF.
I've got the feeling that it will be more intuitive to use geometric algebra instead of linear algebra for the transformation and animation [1].
[1] Projective Geometric Algebra:
I'm confused by this. Why use a 3D matrix for a 2D transformation?
"For example, a point in space is a 3×1 matrix. To transform it, you multiply it by a 3×3 transformation matrix."
It seems we're transforming a point in 3D space using a 3x3 matrix, no?
Say we're working in 2d and have a unit square starting at the origin and we want to translate it right by 1. This is not possible with any kind of matrix multiplication by a 2x2 matrix. That's easy to confirm if you just try it but trivially the lower right hand corner is on the origin and anything you multiply by zero is going to be zero. So any 2x2 matrix you multiply the coordinates of your square by is going to result in something where that point is still at the origin.
So instead what you do is pop your square up a dimension into 3D. So now you have a unit cube. If you do a shear of the unit cube by 1 in the x direction (which is a 3x3 matrix multiplication), you can take the projection ("shadow") of the top face of the cube to get back into 2D and you'll find it's where you wanted it (moved over by 1).
<meta-point: apologies - my original response seems to have been chopped in half. I didn't mean to submit in this form and I was in meetings etc so it's too old to edit now>
https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotati...
We can represent this with the trick of "homogeneous coordinates", using 3D vectors with the last entry 1 and 3x3 matrices with the last row [0, 0, 1].
This is convenient because both mathematicians and programmers are familiar with linear transforms and matrices. It's in the comfort zone. There are many libraries.
However, it's wasteful to store all those extra 1's and 0's in memory. You can always replace the matrices with
class Affine2D { Matrix2x2 linear; Vector2 shift; };
and overload all the algebraic operators, including multiplication with 2D vectors.