MCPcopy Index your code
hub / github.com/anandthakker/euclid

github.com/anandthakker/euclid @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
81 symbols 140 edges 15 files 4 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Euclid

Euclidean geometry in javascript. Here's a demo; here's another one.

NOTE: Still very preliminary / experimental.

git clone https://github.com/anandthakker/euclid.git
cd euclid
npm install
gulp

Usage

Load It:

Add dist/geometry.css for the basic SVG styles.

<link rel="stylesheet" href="https://github.com/anandthakker/euclid/raw/v1.1.0/geometry.css">

Put an <svg> element somewhere.

<svg class="geometry-scene" viewbox="0 0 800 800"></svg>

Pull in the javascript, either as a node module...

var geom = require('euclid');

or a browser standalone(ish) script (depends on d3 to be loaded already).

<script src="https://github.com/anandthakker/euclid/raw/v1.1.0/js/vendor/d3.min.js"></script>
<script src="https://github.com/anandthakker/euclid/raw/v1.1.0/js/geometry.js"></script> 

Use It:

And then

var scene = new geom.Scene({
  left: 0,
  top: 0,
  right: 1000,
  bottom: 1000
});

scene
  .point('A', width/7*3, height/3) // add a couple of free points.
  .poinnt('B', width/7*5, height/3)
  .segment('S', 'A', 'B')

  // add circle centered at point 'A', with point 'B' on its circumference.
  .circle('M', 'A', 'B')
  .circle('N', 'B', 'A')

  // tag subsequent objects with string 'layer2', used by renderer to add
  // arbitrary CSS classes to svg objects.
  .group('layer2')

  // let C and D be the two intersections of circles M and N
  .intersection('C', 'M', 'N', 0)
  .intersection('D', 'M', 'N', 1)
  .line('T', 'A', 'C')
  .segment('U', 'A', 'D')

  // let E be the intersection of line T and circle M that *isn't* equivalent to point C.
  .intersection('E', 'T', 'M', scene.isnt('C') )
  .segment('V', 'E', 'B')
  .intersection('F', 'V', 'U')
  .segment('W', 'F', 'C')
  .intersection('W', 'S')


// render using d3.
var render = geom.renderer(scene, document.querySelector('svg'));
render();

Core symbols most depended-on inside this repo

Shape

Method 43
Function 24
Class 14

Languages

TypeScript100%

Modules by API surface

lib/scene.js21 symbols
lib/model/circle.js9 symbols
lib/render.js8 symbols
lib/model/line.js8 symbols
lib/model/segment.js6 symbols
lib/intersection.js6 symbols
lib/behavior.js6 symbols
lib/model/point.js5 symbols
lib/model/intersection.js5 symbols
lib/model/geom.js4 symbols
lib/calc.js2 symbols
lib/model.js1 symbols

For agents

$ claude mcp add euclid \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page