Welcome to EverybodyWiki 😃 ! Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

# Sarit2d (software)

Original author(s) Cosimo Saccone August 1, 2017; 3 years ago 1.01 / March 1, 2018; 3 years ago Javascript Linux, Mac OS X, Windows, Android Interactive geometry software property sarit2d.altervista.org

Search Sarit2d (software) on Amazon.

Sarit2d is a Javascript library that allows its users to design and solve 2d-geometric problems. The library contains many functions for drawing the main geometric shapes: segments, arcs, points, texts, etc. But the very core of the library are the functions for solving the most common geometry problems: intersections between shapes, areas calculation, geometric formulas, etc. With Sarit2d library it's possible solving hard problems through few code rows.

## Philosofy

Sarit2d, created by Cosimo Saccone, can be used without downloading anything. For using the library it's enough to write the code in the online sandbox and push the run button. If not there are errors, the drawing will be shown or the result will be printed. Sarit2d contains essentially three types of functions: drawing functions, calculating functions, control functions.

### Drawing functions

They are the functions that allow to design a shape (point, line, polygon, etc). They make calculations within them but they don't return any value. Their purpose is to draw.

### Calculating functions

They are the functions that make calculations and return results (intersections, distances, etc).

### Control functions

They are the functions that control various aspects of the library.

1. reflexion
2. symmetry
3. translation
4. rotation
5. scale

## Programming

Geometry problem solved with Sarit2d

Below is a brief example about the operation of the library:

```var m = -2/3, r = 10;
drawCircle(0,0,r);
var q = getIntersectionBetweenLineAndCircle(0,0,5,5*m,0,0,r);
var ax = q[2], ay = q[3], bx = -q[2], by = q[3], cx = q[0], cy = q[1];
drawSegment(ax,ay,cx,cy);
drawRectangle(ax,ay,cx,cy);
var BC = getDistance(cx,cy,bx,by);
drawCircle(cx,cy,BC);
q = getIntersectionBetweenTwoCircles(0,0,r,cx,cy,BC);
var dx = q[2], dy = q[3];
drawSegment(bx,by,dx,dy);
q = getIntersectionBetweenTwoLines(ax,ay,cx,cy,bx,by,dx,dy);
var ex = q[0], ey = q[1];
q = getIntersectionBetweenLineAndCircle(ex,ey,ex,ey+10,cx,cy,BC);
var jx = q[0], jy = q[1], kx = q[2], ky = q[3];
drawSegment(jx,jy,kx,ky);
drawText("A",-10,6);
drawText("B",9,6);
drawText("C",9,-7);
drawText("D",-3,-11);
drawText("E",4,-2);
drawText("J",4,3);
drawText("K",4,-15);
var JK = getDistance(jx,jy,kx,ky);
print(JK);
```