Loading commands, almost done…
Welcome to the interactive Geometry explainer!
Here we go through some of the basic commands to get started with Geomatic. Every command has one of these two formats:
output = \function-name arg1 arg2 ...\function-name arg1 arg2 ...: If an output variable is not provided, one is assigned automatically.The environment already comes loaded with a few geometric objects. One of them is the point at origin. It has the variable name p0. You can run to highlight it.
Highlighting a geometric object (or a node) adds a temporary animation to it to draw attention to it. You will get a warning if you try to highlight a non-existent object like .
p1. This can be done by using the point function. This is as simple as . p0 and p1: . To see the name assigned to the line, you can hover above it (in this case, you should see the name line0).p1 and radius equal to the distance between p0 and p1. This can be done in two steps:You can clear the slate and start over by running . Now let's create a line with points a and b, calculate its midpoint, and draw a circle with center at the midpoint and radius equal to the distance between a and b.
a and b randomly when they don't exist.Here comes the fun part - changing the position of a or b will automatically update all of the other components that depend on them. In this case, these components are the midpoint m and the radius r.
a to be at position (2, 2): .b to be at position (2, -2): .Note how both the midpoint and the radius are updated automatically. You can also translate one of the points by , and the geometry updates accordingly.
Finally, removing point m will also remove the circle, since it depends on m: . Similarly removing point a will also remove the line: .
Reactivity is maintained throughout. Note that some operations like translate will break reactivity. For example, translating the point m will make it not depend on a and b anymore.
We start with an empty canvas by running . Here are a bunch of commands to get a feel for broadcasting:
point but for an array of scalars instead of a single scalar.This idea can be extended further:
You can modify any individual object if needed:
p3: . The circle also moves with it due to reactivity.The API for autograd is similar to PyTorch. As of now, one can only register scalars or points as parameters. The usual way to use automatic differentiation is to register the parameters, define a scalar valued loss function, backpropagate the gradients, and update the parameters using gradient descent.
r: .p0 with radius r: .learning-rate.You will notice the circle get a bit smaller.