GitHub - geometor/model: A symbolic engine for defining and verifying geometric constructions.

A symbolic engine for defining and verifying geometric constructions.

Overview

geometor.model is a symbolic engine for defining and verifying geometric constructions. It treats geometry not as a visual approximation, but as a rigorous system of information and operations.

In this system:

  • Points represent information. They are exact algebraic locations.
  • Lines and Circles represent operations performed on that information.
  • Intersections are the consequences of operations, yielding new information (Points).

We leverage SymPy to ensure that every coordinate and radius is an exact algebraic expression, allowing us to find deep relationships that floating-point arithmetic would miss.

Key Features

  • Symbolic Precision: No rounding errors. $sqrt{2}$ is $sqrt{2}$, not $1.414...$.
  • Ancestry Tracking: Every element knows its parents. We can trace the lineage of any point back to the starting axioms.
  • Automatic Intersection: The model automatically calculates all intersection points whenever a new line or circle is added.
  • Serialization: Models can be saved to JSON and shared with other tools like geometor.explorer.

Installation

pip install geometor-model

Command Line Interface

The geometor.model package includes a robust CLI for interactive construction and scripting (REPL).

Start the session:

Sample commands:

> * 0, 0      # Set point A
> * 1, 0      # Set point B
> ( A B )       # Circle centered at A passing through B
> [ A B ]       # Line through A and B

For full details, see the CLI Usage documentation.

Usage

from geometor.model import Model

# Initialize a new model
model = Model("vesica")

# Define two starting points
A = model.set_point(0, 0, classes=["given"])
B = model.set_point(1, 0, classes=["given"])

# Construct the Vesica Piscis
model.construct_circle(A, B)
model.construct_circle(B, A)

# The model now automatically contains the intersections of these circles
print(model.points)

Resources

Related Projects