Geolang

From Esolang
Jump to navigation Jump to search

Geolang is a programming language made by user:TJC games for helping with geometry.

Who am I kidding, it is a stupid language made by a stupid person.

Not affiliated with the other Geolang.

This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by adding some more information.

Usage

The name of an object cannot be or contain `@`, `[`, `]`, `,`, `(`, `)`, or any of the keywords.

All object names have to be unique.

Instead of listing a single object, where specified, you can have a list of objects.

An object list is surrounded by [], and has commas between items.

Any point input in the below table can take a co-ordinate set as well, except from the `point` command.

Operations

Keyword Usage Mechanic
point point a @ (x, y) Add or move the point called `a` to the co-ordinates (x, y).
point point a @ (x, y) z Add or move the point called `a` to the closest point on object z to the co-ordinates (x, y).
mid mid a @ x y Add a point called `a` to the midpoint of points x and y.
mid mid a @ x Add a point called `a` to the midpoint of segment or arc x.
line line a @ x y Create a line called `a` between points x and y, and extend it infinitely.
ray ray a @ x y Create a line segment called `a` between points x and y, and extend it in the direction of point y.
seg seg a @ x y Create a line called `a` between points x and y.
vect vect a @ x y Create a vector called `a` between points x and y, in the direction of y.
shift shift a @ b x Move point `b` by vector x and call it `a`. Can accept a point for x, where the vector is from (0,0) to the point. Can take a list for b, where it moves all objects.
mirror mirror a @ b x Mirror point `b` along line x and call it `a`. Can accept a point for x, where the line is from (0,0) to the point. Can take a list for b, where it mirrors all objects in the list.
circ circ a @ x y Create a circle called `a` with the centre on point x and the edge on point y.
circ circ a @ x y z Create a circle called `a` touching all points x, y, and z.
arc arc a @ x y z Create an arc called `a` with the centre on x and the ends on points y and z, going clockwise.
poly poly a @ [i, j, k, l...] Create a polygon called `a` with vertices i, j, k, l, and so on (min. 3 arguments).

Animations

Time to make this a contender to Manim. If any anim commands exist in the code, the objects don't draw automatically. If any normal commands exist after an anim command, throw an error.

Keyword Usage Mechanic
var var t @ s Creates a variable called `t` and starts it at `s`. Can be used as a number.
latex latex txt @ z Parse text `z` as a LaTeX string and output as txt.
anim var anim t @ var l z ease Animate the graph with variable `t` at a speed of `l` per second up to `z`, with optional easing. Modifies all objects accordingly.
anim shift anim a @ shift v t ease Translate object `a` by vector `v`, with optional length of animation and easing. Keeps objects from point a @ (x, y) z on object `z`. `a` can be a list, `v` can be a point as a vector from origin, blah blah blah.
anim mirror anim a @ mirror v t ease Mirror object `a` by vector `v`, with optional length of animation and easing. Keeps objects from point a @ (x, y) z on object `z`. `a` can be a list, `v` can be a point as a vector from origin, blah blah blah.
anim wait anim wait @ t Wait `t` seconds.
anim create anim a @ create t ease Create object `a` in `t` seconds, with an optional method.
anim remove anim a @ remove t ease Remove object `a` in `t` seconds, with an optional method.

Examples

Hello world

Hello world programs are technically considered impossible in this language because the output is non-textual. However, there may be alternatives.

If you really wanted to, you could do this:

seg h1 @ (0,0) (0,4)
seg h2 @ (2,0) (2,4)
seg h3 @ (0,2) (2,2)

point e1 @ (3,0)
point e2 @ (3,4)
seg e3 @ e1 e2
seg e4 @ e1 (5,0)
seg e5 @ e2 (5,4)
seg e6 @ (3,2) (5,2)

point l11 @ (6,0)
seg l12 @ l11 (6,4)
seg l13 @ l11 (8,0)

point l21 @ (9,0)
seg l22 @ l21 (9,4)
seg l23 @ l21 (11,0)

seg o11 @ (12,0) (14,0)
seg o12 @ (12,4) (14,4)
seg o13 @ (12,0) (12,4)
seg o14 @ (14,0) (14,4)

point w1 @ (0,-5)
point w2 @ (4,-5)
seg w3 @ w1 w2
seg w4 @ w1 (0,-1)
seg w5 @ (4,-1)
seg w6 @ (2,-5) (2,-3)

seg o21 @ (3,-5) (5,-5)
seg o22 @ (3,-1) (5,-1)
seg o23 @ (3,-5) (3,-1)
seg o24 @ (5,-5) (5,-1)

point r1 @ (6,-1)
point r2 @ (8,-1)
point r3 @ (8,-3)
seg r4 @ r1 r2
seg r5 @ r2 r3
seg r6 @ r1 (6,-5)
seg r7 @ r3 (6,-3)
seg r8 @ (7,-3) (8,-5)

point l31 @ (9,-5)
seg l32 @ l31 (9,-1)
seg l33 @ l31 (11,-5)

seg d1 @ (12,-1) (12,-5)
seg d2 @ (12,-5) (13,-5)
seg d3 @ (13,-5) (14,-4)
seg d4 @ (14,-4) (14,-2)
seg d5 @ (14,-2) (13,-1)
seg d6 @ (13,-1) (12,-1)

Truth machine

It is impossible, proving that this language is not turing complete. Cite: This article

Links

I will start working on a geolang<->geogebra interpreter soon.